用 vue-cli 全新创建项目后,运行 npm run dev 出错。但是原先创建的项目没有问题。
终端内错误如下:
没有给这些选项指定值:config-name, context, entry, module-bind, module-bind-post, module-bind-pre, output-path, output-filename, output-chunk-filename, output-source-map-filename, output-public-path, output-jsonp-function, output-library, output-library-target, records-input-path, records-output-path, records-path, define, target, watch-aggregate-timeout, devtool, resolve-alias, resolve-extensions, resolve-loader-alias, optimize-max-chunks, optimize-min-chunk-size, prefetch, provide, plugin, open-page
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev 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/fungleo/.npm/_logs/2018-01-09T11_39_11_062Z-debug.log
输出日志如下:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]~predev: [email protected]
6 info lifecycle [email protected]~dev: [email protected]
7 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~dev: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/fungleo/Site/MyWork/love/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:~/.bin
9 verbose lifecycle [email protected]~dev: CWD: /home/fungleo/Site/MyWork/love
10 silly lifecycle [email protected]~dev: Args: [ '-c',
10 silly lifecycle 'webpack-dev-server --inline --progress --config build/webpack.dev.conf.js' ]
11 silly lifecycle [email protected]~dev: Returned: code: 1 signal: null
12 info lifecycle [email protected]~dev: Failed to exec dev script
13 verbose stack Error: [email protected] 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/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at EventEmitter.emit (events.js:191:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:852:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/fungleo/Site/MyWork/love
16 verbose Linux 4.9.0-deepin13-amd64
17 verbose argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "dev"
18 verbose node v6.3.1
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
22 error Exit status 1
23 error Failed at the [email protected] dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
操作系统 deepin 15.5 最新版
晕了,之前没遇到过这种情况,希望得到指点,谢谢!
是因为新版本的 webpack-dev-server 错了。解决方法如下:
#
npm remove webpack-dev-server
npm install [email protected]
npm run dev
参考:http://blog.csdn.net/fungleo/article/details/79016838
@fengcms 谢谢
谢谢
我唯一的解决方法是,Del node_module
按照你说的做了 但是还是报错[email protected] dev: webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
错误原因是因为webpack-dev-server版本和vue版本不一样,需要将webpack-dev-server卸载了,安装对应版本
查看vue版本是 vue -V (这个V是大写的)
卸载npm uninstall webpack-dev-server,
在安装这个npm i [email protected],我的可以正常启动了。
the second time ,has this problem
Most helpful comment
是因为新版本的 webpack-dev-server 错了。解决方法如下:
# npm remove webpack-dev-server npm install [email protected] npm run dev
参考:http://blog.csdn.net/fungleo/article/details/79016838