Webpack-dev-server: Error spawn EACCES with webpack dev server for vue-cli

Created on 13 Jun 2017  ·  9Comments  ·  Source: webpack/webpack-dev-server

My environment:

  • Centos7 via VirtualBox (installed on Windows7)
  • Node version: 6.10.3
  • Npm version : 3.10.10
  • I'm behind a corporate proxy

I initialized a new project "vuetest" with vue-cli, and now I want to run a webpack server. I use the following command:
npm run dev

This command is equivalent to "webpack-dev-server --open --hot", here is my "package.json" file to check:

{
  "name": "vuetest",
  "description": "A Vue.js project",
  "version": "1.0.0",
  "author": "",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
  },
  "dependencies": {
    "vue": "^2.3.3"
  },
  "devDependencies": {
    "babel-core": "^6.0.0",
    "babel-loader": "^6.0.0",
    "babel-preset-env": "^1.5.1",
    "cross-env": "^3.2.4",
    "css-loader": "^0.25.0",
    "file-loader": "^0.9.0",
    "vue-loader": "^12.1.0",
    "vue-template-compiler": "^2.3.3",
    "webpack": "^2.6.1",
    "webpack-dev-server": "^2.4.5"
  }
}

But I get the following error:

> [email protected] dev /var/www/html/vuetest
> cross-env NODE_ENV=development webpack-dev-server --open --hot

Project is running at http://localhost:8080/
webpack output is served from /dist/
404s will fallback to /index.html
internal/child_process.js:319
    throw errnoException(err, 'spawn');
    ^

Error: spawn EACCES
    at exports._errnoException (util.js:1018:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at Object.exports.spawn (child_process.js:378:9)
    at module.exports (/var/www/html/vuetest/node_modules/opn/index.js:75:24)
    at reportReadiness (/var/www/html/vuetest/node_modules/webpack-dev-server/bin/webpack-dev-server.js:424:3)
    at Server.<anonymous> (/var/www/html/vuetest/node_modules/webpack-dev-server/bin/webpack-dev-server.js:404:4)
    at Server.g (events.js:292:16)
    at emitNone (events.js:86:13)
    at Server.emit (events.js:185:7)
    at emitListeningNT (net.js:1284:10)

npm ERR! Linux 3.10.0-514.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script 'cross-env NODE_ENV=development webpack-dev-server --open --hot'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vuetest package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cross-env NODE_ENV=development webpack-dev-server --open --hot
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs vuetest
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls vuetest
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/html/vuetest/npm-debug.log

Here's the contents of the "npm-debug.log" file:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/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 silly lifecycle [email protected]~predev: no script for predev, continuing
7 info lifecycle [email protected]~dev: [email protected]
8 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~dev: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/var/www/html/vuetest/node_modules/.bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/bdupre/.local/bin:/home/bdupre/bin
10 verbose lifecycle [email protected]~dev: CWD: /var/www/html/vuetest
11 silly lifecycle [email protected]~dev: Args: [ '-c',
11 silly lifecycle   'cross-env NODE_ENV=development webpack-dev-server --open --hot' ]
12 silly lifecycle [email protected]~dev: Returned: code: 1  signal: null
13 info lifecycle [email protected]~dev: Failed to exec dev script
14 verbose stack Error: [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:886:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd /var/www/html/vuetest
17 error Linux 3.10.0-514.el7.x86_64
18 error argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
19 error node v6.10.3
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
22 error Exit status 1
23 error Failed at the [email protected] dev script 'cross-env NODE_ENV=development webpack-dev-server --open --hot'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the vuetest package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     cross-env NODE_ENV=development webpack-dev-server --open --hot
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs vuetest
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls vuetest
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Does anyone know how to fix it please?


This issue was moved from webpack/webpack#5052 by @sokra. Orginal issue was by @TisteDup.

Problem with opn?

question

Most helpful comment

I was getting the same error with vue-cli.
Turns out the scripts couldn't be able to spawn a new browser process.
Just remove the open flag

All 9 comments

Closing due to inactivity. Stack Overflow or the Webpack Gitter may yield more support for triaging the issue on your system. It's not been a widely reported issue however.

i think i maybe got the same problem.And i work on the Ubuntu 14.04 64bit.

> [email protected] dev /media/milo/Study/nanguan/cherry-ui
> cross-env NODE_ENV=development webpack-dev-server --inline --hot --port 8086

internal/child_process.js:319
    throw errnoException(err, 'spawn');
    ^

Error: spawn EACCES
    at exports._errnoException (util.js:1020:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at Object.exports.spawn (child_process.js:369:9)
    at spawn (/usr/local/lib/node_modules/cross-env/node_modules/cross-spawn/index.js:17:18)
    at crossEnv (/usr/local/lib/node_modules/cross-env/dist/index.js:31:38)
    at Object.<anonymous> (/usr/local/lib/node_modules/cross-env/dist/bin/cross-env.js:6:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --inline --hot --port 8086`
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.

============================

Here is the debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/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/local/lib/node_modules/npm/bin/node-gyp-bin:/media/milo/Study/nanguan/cherry-ui/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
9 verbose lifecycle [email protected]~dev: CWD: /media/milo/Study/nanguan/cherry-ui
10 silly lifecycle [email protected]~dev: Args: [ '-c',
10 silly lifecycle   'cross-env NODE_ENV=development webpack-dev-server --inline --hot --port 8086' ]
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: `cross-env NODE_ENV=development webpack-dev-server --inline --hot --port 8086`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:289: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/local/lib/node_modules/npm/lib/utils/spawn.js:40: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:891:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
14 verbose pkgid [email protected]
15 verbose cwd /media/milo/Study/nanguan/cherry-ui
16 verbose Linux 4.4.0-89-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v6.11.2
19 verbose npm  v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --inline --hot --port 8086`
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 ]

Here is the package.json :

{
  "name": "apple",
  "version": "1.0.0",
  "description": "A Vue.js project",
  "author": "L Yunparty <[email protected]>",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --port 8086",
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
  },
  "dependencies": {
    "axios": "^0.16.2",
    "element-ui": "^1.4.2",
    "style-loader": "^0.18.2",
    "vue": "^2.4.2",
    "vue-resource": "^1.3.4",
    "vue-router": "^2.3.1",
    "webpack-dev-server": "^2.7.1"
  },
  "devDependencies": {
    "autoprefixer": "^6.7.2",
    "babel-core": "^6.22.1",
    "babel-eslint": "^7.1.1",
    "babel-loader": "^6.2.10",
    "babel-plugin-istanbul": "^4.1.1",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-preset-env": "^1.6.0",
    "babel-preset-stage-2": "^6.22.0",
    "babel-register": "^6.22.0",
    "chai": "^3.5.0",
    "chalk": "^1.1.3",
    "chromedriver": "^2.31.0",
    "connect-history-api-fallback": "^1.3.0",
    "copy-webpack-plugin": "^4.0.1",
    "cross-env": "^4.0.0",
    "cross-spawn": "^5.0.1",
    "css-loader": "^0.28.0",
    "eslint": "^3.19.0",
    "eslint-config-standard": "^6.2.1",
    "eslint-friendly-formatter": "^2.0.7",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-html": "^2.0.0",
    "eslint-plugin-promise": "^3.4.0",
    "eslint-plugin-standard": "^2.0.1",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.15.4",
    "extract-text-webpack-plugin": "^2.0.0",
    "file-loader": "^0.11.1",
    "friendly-errors-webpack-plugin": "^1.1.3",
    "html-webpack-plugin": "^2.30.1",
    "http-proxy-middleware": "^0.17.3",
    "inject-loader": "^3.0.1",
    "karma": "^1.4.1",
    "karma-coverage": "^1.1.1",
    "karma-mocha": "^1.3.0",
    "karma-phantomjs-launcher": "^1.0.2",
    "karma-phantomjs-shim": "^1.4.0",
    "karma-sinon-chai": "^1.3.1",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-spec-reporter": "0.0.30",
    "karma-webpack": "^2.0.4",
    "lolex": "^1.5.2",
    "mocha": "^3.5.0",
    "nightwatch": "^0.9.12",
    "opn": "^4.0.2",
    "optimize-css-assets-webpack-plugin": "^1.3.0",
    "ora": "^1.2.0",
    "rimraf": "^2.6.0",
    "selenium-server": "^3.5.0",
    "semver": "^5.4.1",
    "shelljs": "^0.7.6",
    "sinon": "^2.4.1",
    "sinon-chai": "^2.12.0",
    "url-loader": "^0.5.8",
    "vue-loader": "^12.2.2",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.4.2",
    "webpack": "^2.7.0",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-middleware": "^1.12.0",
    "webpack-hot-middleware": "^2.18.2",
    "webpack-merge": "^4.1.0"
  },
  "engines": {
    "node": ">= 4.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

Same error here, but when I remove --open option from npm script then all is working ok.

╰─ npm run dev

> [email protected] dev /home/xyz/work/test
> cross-env NODE_ENV=development webpack-dev-server --hot --open

Project is running at http://localhost:8080/
webpack output is served from /dist/
404s will fallback to /index.html
internal/child_process.js:325
    throw errnoException(err, 'spawn');
    ^

Error: spawn EACCES
    at _errnoException (util.js:1041:11)
    at ChildProcess.spawn (internal/child_process.js:325:11)
    at Object.exports.spawn (child_process.js:493:9)
    at module.exports (/home/xyz/work/test/node_modules/opn/index.js:75:24)
    at reportReadiness (/home/xyz/work/test/node_modules/webpack-dev-server/bin/webpack-dev-server.js:475:3)
    at Server.<anonymous> (/home/xyz/work/test/node_modules/webpack-dev-server/bin/webpack-dev-server.js:447:4)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:105:13)
    at Server.emit (events.js:207:7)
    at emitListeningNT (net.js:1349:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --hot --open`
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/xyz/.npm/_logs/2017-08-28T17_06_50_743Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/home/xyz/.nodenv/versions/8.4.0/bin/node',
1 verbose cli   '/home/xyz/.nodenv/versions/8.4.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   '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: /home/xyz/.nodenv/versions/8.4.0/lib/node_modules/npm/bin/node-gyp-bin:/home/xyz/work/test/node_modules/.bin:/home/xyz/.nodenv/versions/8.4.0/bin:/home/xyz/.nodenv/libexec:/home/xyz/.nodenv/plugins/nodenv-update/bin:/home/xyz/.nodenv/plugins/nodenv-package-rehash/bin:/home/xyz/.nodenv/plugins/nodenv-npm-migrate/bin:/home/xyz/.nodenv/plugins/nodenv-each/bin:/home/xyz/.nodenv/plugins/node-build-update-defs/bin:/home/xyz/.nodenv/plugins/node-build/bin:/home/xyz/.zplug/bin:/home/xyz/.zplug/repos/zplug/zplug/bin:/home/xyz/.zplug/bin:/home/xyz/.nodenv/shims:/home/xyz/.nodenv/bin:/home/xyz/.dotfiles/bin:/home/xyz/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/xyz/.config/composer/vendor/bin:/home/xyz/.config/composer/vendor/bin
9 verbose lifecycle [email protected]~dev: CWD: /home/xyz/work/test
10 silly lifecycle [email protected]~dev: Args: [ '-c',
10 silly lifecycle   'cross-env NODE_ENV=development webpack-dev-server --hot --open' ]
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: `cross-env NODE_ENV=development webpack-dev-server --hot --open`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/home/xyz/.nodenv/versions/8.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/home/xyz/.nodenv/versions/8.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/xyz/work/test
16 verbose Linux 4.12.8-2-ARCH
17 verbose argv "/home/xyz/.nodenv/versions/8.4.0/bin/node" "/home/xyz/.nodenv/versions/8.4.0/bin/npm" "run" "dev"
18 verbose node v8.4.0
19 verbose npm  v5.4.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --hot --open`
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 ]



md5-0304c817e870adbe7b9f64f7f9c13580



{
  "name": "test",
  "description": "A Vue.js project",
  "version": "1.0.0",
  "author": "",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development webpack-dev-server --hot --open",
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
  },
  "dependencies": {
    "vue": "^2.4.2"
  },
  "devDependencies": {
    "babel-core": "^6.0.0",
    "babel-loader": "^6.0.0",
    "babel-preset-env": "^1.5.1",
    "cross-env": "^3.0.0",
    "css-loader": "^0.25.0",
    "file-loader": "^0.9.0",
    "vue-loader": "^12.1.0",
    "vue-template-compiler": "^2.3.3",
    "webpack": "^2.7.0",
    "webpack-dev-server": "^2.7.1"
  }
}



md5-0304c817e870adbe7b9f64f7f9c13580



╰─ npm list --depth=0   
[email protected] /home/xyz/work/test
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]



md5-0304c817e870adbe7b9f64f7f9c13580



╰─ npm list -g --depth 0
/home/xyz/.nodenv/versions/8.4.0/lib
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

I was getting the same error with vue-cli.
Turns out the scripts couldn't be able to spawn a new browser process.
Just remove the open flag

removed --open and it didn't work to me

Sorry guys, but I can't find what file the --open flag is at

In package.json you have dev script and there it is :)

It's not for me. Am using node build/dev-server.js. But I was able to solve the problem. It's a read/write permission with the opn module. What I did is grant permission to the file (sudo chmod -R u+x node_module/opn/xdg-open) from the project root, and it was good to go.

Thanks for your timely response @dw72

follow this thread and has solution for it to downgrade webpack version.
https://github.com/vuejs/vue-cli/issues/714

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrdulin picture mrdulin  ·  3Comments

antoinerousseau picture antoinerousseau  ·  3Comments

movie4 picture movie4  ·  3Comments

hnqlvs picture hnqlvs  ·  3Comments

adiachenko picture adiachenko  ·  3Comments