Wiranatha
Wiranatha

Reputation: 31

Cant run npm script, it shown "Error: spawn node_modules/webpack/bin/webpack.js EACCES"

I am trying to run my project on Linux Mint that I just installed and configured but when I run the npm run dev command. "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 complete 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."

Upvotes: 3

Views: 8563

Answers (6)

Magesh Kannan
Magesh Kannan

Reputation: 1

install latest webpack and webpack-cli it resolved issue

Upvotes: 0

fogelkuba
fogelkuba

Reputation: 59

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 command was solution for me:

chmod -R +x node_modules

Upvotes: 0

SebastienGllmt
SebastienGllmt

Reputation: 86

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

Upvotes: 0

Martin Cup
Martin Cup

Reputation: 2582

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.

Upvotes: 0

jisna
jisna

Reputation: 2444

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

I just followed above steps and it worked.

Upvotes: 14

Ahmed Maruf
Ahmed Maruf

Reputation: 511

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 recomended). 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 command npm run development or production depending on your deployment environment

Upvotes: 0

Related Questions