我正在尝试首次构建项目,但收到错误消息。
Insufficient number of arguments or no entry found.
Alternatively, run 'webpack(-cli) --help' for usage info.
Hash: 83fdf40d8aadb2841816
Version: webpack 4.18.0
Time: 180ms
Built at: 09/11/2018 4:55:53 AM
ERROR in Entry module not found: Error: Can't resolve './src' in '/home/baudhi/website'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! website@15.19.1 build: `webpack --mode production`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the website@15.19.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/baudhi/.npm/_logs/2018-09-11T11_55_53_650Z-debug.log
我正在阅读的电子书要求我键入“ npm run build”,但无法正常工作。任何帮助。
我的package.json文件如下所示:
{
"name": "website",
"version": "15.19.1",
"description": "just practice",
"main": "main.js",
"scripts": {
"develop": "webpack --mode development --watch",
"build": "webpack --mode production"
},
"author": "pebaudhi",
"license": "ISC",
"devDependencies": {
"webpack": "^4.18.0",
"webpack-cli": "^3.1.0"
},
"dependencies": {
"jquery": "^3.3.1"
}
}
我的目录结构是:
/usr/baudhi/website/.babelrc
/usr/baudhi/website/package.json
/usr/baudhi/website/jquery-3.3.1.js
/usr/baudhi/website/src/main.js
/usr/baudhi/website/dist/main.js
node -v
v10.7.0
非常感谢您的帮助。
答案 0 :(得分:0)
如果您使用的是Webpack 4,则配置为默认设置。因此,您不需要提供webpack.config.json
文件,但是您的项目需要遵循默认配置。
Webpack 4中的默认入口点是./src/index.js
。因此,请重命名./src/main.js
或创建具有以下最小值的webpack.config.js
文件。
module.exports = {
entry: './src/main.js'
};