我使用webpack克隆了一个egghead项目(很棒的教程)。 我遇到了以下错误:
0 info it worked if it ends with ok
1 verbose cli [ 'c:\Program Files\nodejs\\node.exe',
1 verbose cli 'c:\Program Files\nodejs\nodemodules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm@2.5.1
3 info using node@v0.12.0
4 verbose node symlink c:\Program Files\nodejs\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart webpack-angular@1.0.0
7 info start webpack-angular@1.0.0
8 verbose unsafe-perm in lifecycle true
9 info webpack-angular@1.0.0 Failed to exec start script
10 verbose stack Error: webpack-angular@1.0.0 start: `node nodemodules/.bin/webpack-dev-server --content-base app
10 verbose stack Exit status 1
10 verbose stack at EventEmitter.<anonymous> (c:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
10 verbose stack at EventEmitter.emit (events.js:110:17)
10 verbose stack at ChildProcess.<anonymous> (c:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:14:12)
10 verbose stack at ChildProcess.emit (events.js:110:17)
10 verbose stack at maybeClose (child_process.js:1008:16)
10 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
11 verbose pkgid webpack-angular@1.0.0
12 verbose cwd C:\Users\Yonk\Documents\webPackApp
13 error Windows_NT 6.1.7601
14 error argv "c:\\Program Files\\nodejs\\\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
15 error node v0.12.0
16 error npm v2.5.1
17 error code ELIFECYCLE
18 error webpack-angular@1.0.0 start:node nodemodules/.bin/webpack-dev-server --content-base app`
18 error Exit status 1
19 error Failed at the webpack-angular@1.0.0 start script 'node nodemodules/.bin/webpack-dev-server --content-base app'.
19 error This is most likely a problem with the webpack-angular package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error node node_modules/.bin/webpack-dev-server --content-base app
19 error You can get their info via:
19 error npm owner ls webpack-angular
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]
我的步骤是:
知道为什么会这样,以及如何解决这个问题?
答案 0 :(得分:6)
使用bash脚本服务器的课程的初始配置在Linux下运行,导致Windows出错。要在Windows下启动服务器,您需要在package.json start script line
更改:
来自:
"start": "node node_modules/.bin/webpack-dev-server --content-base app"
到此:
"start": "node_modules/.bin/webpack-dev-server.cmd --content-base app"