最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Cant run npm script, it shown "Error: spawn node_moduleswebpackbinwebpack.js EACCES" - Stack Over

programmeradmin3浏览0评论

I am trying to run my project on Linux Mint that I just installed and configured but when I run the npm run dev mand. "spawn node_modules / webpack / bin / webpack.js EACCES" error appears.

I have tried all the methods provided on the internet such as reinstalling nodes, upgrading versions, clear cache nodes and deleting folders. but still error.

> @ dev /home/wirnat/Web/Bukasewa/bukasewa.vBETA
> node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

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

Error: spawn node_modules/webpack/bin/webpack.js EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: 'EACCES',
  code: 'EACCES',
  syscall: 'spawn node_modules/webpack/bin/webpack.js',
  path: 'node_modules/webpack/bin/webpack.js',
  spawnargs: [
    '--progress',
    '--hide-modules',
    '--config=node_modules/laravel-mix/setup/webpack.config.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A plete log of this run can be found in:
npm ERR!     /home/wirnat/.npm/_logs/2019-10-17T12_37_01_854Z-debug.log 

"maybe this problem has to do with permission, but I'm just learning linux and don't really understand it."

I am trying to run my project on Linux Mint that I just installed and configured but when I run the npm run dev mand. "spawn node_modules / webpack / bin / webpack.js EACCES" error appears.

I have tried all the methods provided on the internet such as reinstalling nodes, upgrading versions, clear cache nodes and deleting folders. but still error.

> @ dev /home/wirnat/Web/Bukasewa/bukasewa.vBETA
> node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

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

Error: spawn node_modules/webpack/bin/webpack.js EACCES
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: 'EACCES',
  code: 'EACCES',
  syscall: 'spawn node_modules/webpack/bin/webpack.js',
  path: 'node_modules/webpack/bin/webpack.js',
  spawnargs: [
    '--progress',
    '--hide-modules',
    '--config=node_modules/laravel-mix/setup/webpack.config.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A plete log of this run can be found in:
npm ERR!     /home/wirnat/.npm/_logs/2019-10-17T12_37_01_854Z-debug.log 

"maybe this problem has to do with permission, but I'm just learning linux and don't really understand it."

Share Improve this question asked Oct 17, 2019 at 12:58 WiranathaWiranatha 311 silver badge3 bronze badges 2
  • 1 try this, chmod -R 777 ./yourproject – CodeBug Commented Jul 23, 2020 at 7:14
  • Dont ever do chmod -R 777, this is going to give permissions to everyone. Just remove node_modules and install them again. – Ivan Velinov Commented Nov 8, 2020 at 6:50
Add a ment  | 

6 Answers 6

Reset to default 14
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

I just followed above steps and it worked.

I faced the same problem today. Here is my solution

Check your permissions if the node_modules folder is executable by running ls -la (760 is reended). If thing seems to be okay then try deleting the node_modules folder and install all the modules again by running npm install then run the mand npm run development or production depending on your deployment environment

Error: spawn node_modules/webpack/bin/webpack.js EACCES indicates that this same file has no execution rights. I had the same error, and when I added the execution rights it worked.

Make sure that you do not have NODE_ENV=production set in your terminal, as it will cause npm install to skip devDependencies including webpack. You can fix this by clearing the NODE_ENV value (unset NODE_ENV) and then running npm install again

Run into same issue recently with some old project based on Laravel Mix.

Error suggests, that there can be issue with execution rights.

Running this mand was solution for me:

chmod -R +x node_modules

install latest webpack and webpack-cli it resolved issue

发布评论

评论列表(0)

  1. 暂无评论