将webpack-dev-server更新为3.2.1后的Vue.js项目-引发错误

时间:2019-03-05 03:54:01

标签: node.js vue.js webpack webpack-dev-server

在更新到3.2.1版本时,它将引发错误。在2.9.7之前没有此错误。

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run-script',
1 verbose cli   'dev' ]
2 info using npm@6.8.0
3 info using node@v10.13.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle mcute@1.0.0~predev: mcute@1.0.0
6 info lifecycle mcute@1.0.0~dev: mcute@1.0.0
7 verbose lifecycle mcute@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle mcute@1.0.0~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/turtuvshin/Projects/mcute/frontend/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/turtuvshin/Projects/mcute/node_modules/.bin:/usr/local/mongodb/bin:/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/mongodb/bin:/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin
9 verbose lifecycle mcute@1.0.0~dev: CWD: /Users/turtuvshin/Projects/mcute/frontend
10 silly lifecycle mcute@1.0.0~dev: Args: [ '-c',
10 silly lifecycle   'webpack-dev-server --inline --progress --config build/webpack.dev.conf.js' ]
11 silly lifecycle mcute@1.0.0~dev: Returned: code: 1  signal: null
12 info lifecycle mcute@1.0.0~dev: Failed to exec dev script
13 verbose stack Error: mcute@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid mcute@1.0.0
15 verbose cwd /Users/turtuvshin/Projects/mcute/frontend
16 verbose Darwin 18.2.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run-script" "dev"
18 verbose node v10.13.0
19 verbose npm  v6.8.0
20 error code ELIFECYCLE
21 error errno 1
22 error mcute@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
22 error Exit status 1
23 error Failed at the mcute@1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

1 个答案:

答案 0 :(得分:0)

关于此错误,存在各种问题。 从版本2.9.7升级webpack-dev-server时存在一个已知错误。 最快的解决方案是将其降级到v2.9.7

npm install webpack-dev-server@2.9.7 --save-dev

此外,还要检查项目中的vuejs版本和webpack版本,因为它们也必须与wepack-dev-server的正确版本兼容。