刚进行到npm run build的时候提示要安装webpack-cli

来源:2-1 vue-loader+webpack项目配置

ZG_007

2020-12-09 12:00

刚进行到npm run build的时候提示要安装webpack-cli,不装进行不了。装好了以后再运行也报错

D:\Vue_program\vue-ssr-tech\node_modules\webpack\lib\cli.js:66

                        .replace(

                        ^

SyntaxError: Invalid regular expression: /(\p{Uppercase_Letter}+|\p{Lowercase_Letter}|\d)(\p{Uppercase_Letter}+)/: Invalid escape

    at pathToArgumentName (D:\Vue_program\vue-ssr-tech\node_modules\webpack\lib\cli.js:66:4)

    at addFlag (D:\Vue_program\vue-ssr-tech\node_modules\webpack\lib\cli.js:170:16)

    at traverse (D:\Vue_program\vue-ssr-tech\node_modules\webpack\lib\cli.js:243:21)

    at traverse (D:\Vue_program\vue-ssr-tech\node_modules\webpack\lib\cli.js:299:23)

    at traverse (D:\Vue_program\vue-ssr-tech\node_modules\webpack\lib\cli.js:248:24)

    at Object.getArguments (D:\Vue_program\vue-ssr-tech\node_modules\webpack\lib\cli.js:308:2)

    at Object.<anonymous> (D:\Vue_program\vue-ssr-tech\node_modules\webpack-cli\lib\utils\cli-flags.js:245:30)

    at Module._compile (D:\Vue_program\vue-ssr-tech\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)

    at Object.Module._extensions..js (module.js:663:10)

    at Module.load (module.js:565:32)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! vue-ssr-tech@1.0.0 build: `webpack --config webpack.config.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the vue-ssr-tech@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!     D:\nodejs\node_cache\_logs\2020-12-09T03_57_27_871Z-debug.log


写回答 关注

2回答

  • A空城
    2020-12-14 09:02:37

    webpack-cli版本太高,降到3.几的版本就可以了

  • ZG_007
    2020-12-09 14:36:44

    已经安装了webpack-cli@4.2.0  webpack@5.10.0

    依旧显示这个错误

Vue+Webpack打造todo应用

用前端最热门框架Vue+最火打包工具Webpack打造todo应用

84606 学习 · 787 问题

查看课程

相似问题