一、npm run build 发生错误,代码如下,对号入座
> node build/build.js
- building for production...path.js:39
throw new ERR_INVALID_ARG_TYPE('path', 'string', path);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at assertPath (path.js:39:11)
at Object.resolve (path.js:166:7)
at HtmlWebpackPlugin.apply (D:\NewVue\vuetest\node_modules\html-webpack-plugin\index.js:41:12)
at Compiler.apply (D:\NewVue\vuetest\node_modules\tapable\lib\Tapable.js:375:16)
at webpack (D:\NewVue\vuetest\node_modules\webpack\lib\webpack.js:33:19)
at err (D:\NewVue\vuetest\build\build.js:19:3)
at next (D:\NewVue\vuetest\node_modules\rimraf\rimraf.js:83:7)
at CB (D:\NewVue\vuetest\node_modules\rimraf\rimraf.js:119:9)
at FSReqWrap.oncomplete (fs.js:141:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vuetest@1.0.0 build: `node build/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vuetest@1.0.0 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! C:\Users\pen.chen\AppData\Roaming\npm-cache\_logs\2021-01-24T11_15_30_793Z-debug.log
二、网上查寻了很多,有不少关于版本的问题,我这里遇到的是“大白菜” 的问题。是在增加多网页设计时把内容填写错误导致。
三、上述 两个index 修改为对应的名称即可,如下:
四、这里的 one, two 是在如下这个位置里设置的。
五、我因为这个问题,查找了 3 个小时,写笔记,以免以后犯同样的问题。 大家共勉。