PanJiaChen / vue-element-admin

:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
MIT License
87.9k stars 30.46k forks source link

Unable to npm run dev: spawn webpack-dev-server ENOENT error #1133

Closed alvassin closed 6 years ago

alvassin commented 6 years ago

Can you help please? Unable to build / run dev :(

$ npm run dev

> vue-element-admin@3.9.0 dev /Users/alvassin/Work/vue-element-admin
> cross-env BABEL_ENV=development webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: spawn webpack-dev-server ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:279:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:752:3)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
    at onErrorNT (internal/child_process.js:407:16)
    [... lines matching original stack trace ...]
    at bootstrapNodeJSCore (internal/bootstrap/node.js:752:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-element-admin@3.9.0 dev: `cross-env BABEL_ENV=development webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-element-admin@3.9.0 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!     /Users/alvassin/.npm/_logs/2018-09-26T06_59_21_727Z-debug.log

Log source:

$ cat /Users/alvassin/.npm/_logs/2018-09-26T06_59_21_727Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/10.11.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'dev' ]
2 info using npm@6.4.1
3 info using node@v10.11.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle vue-element-admin@3.9.0~predev: vue-element-admin@3.9.0
6 info lifecycle vue-element-admin@3.9.0~dev: vue-element-admin@3.9.0
7 verbose lifecycle vue-element-admin@3.9.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle vue-element-admin@3.9.0~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/alvassin/Work/vue-element-admin/node_modules/.bin:/Users/alvassin/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/munki:/Library/Frameworks/Mono.framework/Versions/Current/Commands
9 verbose lifecycle vue-element-admin@3.9.0~dev: CWD: /Users/alvassin/Work/vue-element-admin
10 silly lifecycle vue-element-admin@3.9.0~dev: Args: [ '-c',
10 silly lifecycle   'cross-env BABEL_ENV=development webpack-dev-server --inline --progress --config build/webpack.dev.conf.js' ]
11 silly lifecycle vue-element-admin@3.9.0~dev: Returned: code: 1  signal: null
12 info lifecycle vue-element-admin@3.9.0~dev: Failed to exec dev script
13 verbose stack Error: vue-element-admin@3.9.0 dev: `cross-env BABEL_ENV=development 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 vue-element-admin@3.9.0
15 verbose cwd /Users/alvassin/Work/vue-element-admin
16 verbose Darwin 17.7.0
17 verbose argv "/usr/local/Cellar/node/10.11.0/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v10.11.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error vue-element-admin@3.9.0 dev: `cross-env BABEL_ENV=development webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
22 error Exit status 1
23 error Failed at the vue-element-admin@3.9.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 ]
PanJiaChen commented 6 years ago

https://github.com/vuejs/vue-cli/issues/486

MidaAiZ commented 5 years ago

I fixed it by running below to install all the packages.

sudo npm install -g --unsafe-perm=false --allow-root

detail: https://stackoverflow.com/questions/52382962/npm-error-while-i-try-to-execute-npm-run-dev-command-in-my-terminal

shyaaam commented 3 years ago

or using a previous version is a much cleaner solution

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

jakedowns commented 2 years ago

or using a previous version is a much cleaner solution

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

awe, sadly this didn't resolve it for me :<

I fixed it by running below to install all the packages.

sudo npm install -g --unsafe-perm=false --allow-root

detail: https://stackoverflow.com/questions/52382962/npm-error-while-i-try-to-execute-npm-run-dev-command-in-my-terminal

that seems like... not a good idea 😬