npm run build报错了,老师帮看下什么问题吧

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

慕尼黑8108885

2021-01-05 22:23

过程是一步步按照视频走的。

hanyanshuo@hanyanshuodeMacBook-Pro learnTodoList $ npm run build

> learntodolist@1.0.0 build /Users/hanyanshuo/Desktop/learnTodoList

> webpack --config webpack.config.js


/Users/hanyanshuo/Desktop/learnTodoList/node_modules/webpack-cli/lib/webpack-cli.js:625

            const globalOptions = program.helpInformation().match(/Options:\n(?<globalOptions>.+)\nCommands:\n/s);

                                                                  ^


SyntaxError: Invalid regular expression flags

    at NativeCompileCache._moduleCompile (/Users/hanyanshuo/Desktop/learnTodoList/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)

    at Module._compile (/Users/hanyanshuo/Desktop/learnTodoList/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)

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

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

    at tryModuleLoad (module.js:497:12)

    at Function.Module._load (module.js:489:3)

    at Module.require (module.js:579:17)

    at require (/Users/hanyanshuo/Desktop/learnTodoList/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)

    at Object.<anonymous> (/Users/hanyanshuo/Desktop/learnTodoList/node_modules/webpack-cli/lib/bootstrap.js:1:82)

    at Module._compile (/Users/hanyanshuo/Desktop/learnTodoList/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! learntodolist@1.0.0 build: `webpack --config webpack.config.js`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the learntodolist@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

写回答 关注

2回答

  • 宝慕林3391655
    2021-01-17 16:40:29

    webpack-cli版本兼容问题吧,先卸载webpack-cli,换其他版本的webpack-cli试试

  • 慕粉2242096929
    2021-01-11 21:02:25

    看这个提示好像是正则表达式出问题了?

Vue+Webpack打造todo应用

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

84606 学习 · 787 问题

查看课程

相似问题