【发布时间】:2020-02-05 06:07:33
【问题描述】:
我在尝试运行时收到此错误 - 在我的命令提示符中运行 npm run dev:
Insufficient number of arguments or no entry found.
Alternatively, run 'webpack(-cli) --help' for usage info.
Hash: af4cfdb00272137cb4d3
Version: webpack 4.41.5
Time: 60ms
Built at: 02/05/2020 10:38:54 AM
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Users\dahiy\Desktop\Web developer Course\JS - Basics 2\forkit'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! forkify@1.0.0 dev: `webpack`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the forkify@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
这就是我的 webpack.config.js 的样子:
const path = require('path');
module.exports = {
entry:'./src/js/index.js',
output: {
path: path.resolve(__dirname, 'dist/js'),
filename:'bundle.js'
},
mode:'development'
};
这是我的 package.json:
{
"name": "forkify",
"version": "1.0.0",
"description": "forkify project",
"main": "index.js",
"scripts": {
"dev": "webpack"
},
"author": "Sachin Dahiya",
"license": "ISC",
"devDependencies": {
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
},
"dependencies": {}
}
我已尽一切努力解决此错误,但没有找到任何解决方案来解决此问题。请帮帮我。在此处附上错误的屏幕截图。 error
【问题讨论】:
-
是否存在以下目录:'src' 和 'src/js'?
-
@theBashShell:是的。下面是文件夹结构:Desktop-->Web developer Course-->JS - Basics 2-->forkit-->src-->js
标签: javascript node.js npm webpack