简体   繁体   中英

Webpack: error while running "npm start"

I've cloned an egghead project using webpack (great tutorial). I've ran into the following error:

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 ]

My steps were:

  1. Unzip
  2. npm install
  3. npm start

Any idea why this happened and how to fix this?

The initial configuration of the lesson using bash script server runs under Linux, resulting in an error on Windows. To start the server under the Windows you need change at package.json start script line :

from this:

"start": "node node_modules/.bin/webpack-dev-server --content-base app"

to this:

"start": "node_modules/.bin/webpack-dev-server.cmd --content-base app"

Actually, this issue is created whenever you are not giving the specific path to node_modules for the interaction of node.js. These kinds of issues have come on screen.

Make sure your react-app project is in a specific folder nothing else is present only the node modules folder, public folder, src folder, package.json, etc. This kind of stuff is not placed correctly in one folder. So these kinds of issues come to screen.

I think these are correct and valid reasons. I was facing these issues and resolved these issues by doing this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM