'npm ERR! code ENOENT, npm ERR! errno 34

This is my start script for a React application.

"scripts": {
    "prestart": "babel-node tools/startMessage.js",
    "start": "npm-run-all --parallel test:watch open:src lint:watch",
    "open:src": "babel-node tools/srcServer.js",
    "lint": "node_modules/.bin/esw webpack.config.* src tools",
    "lint:watch": "npm run lint -- --watch",
    "test": "mocha --reporter progress tools/testSetup.js \"src/**/*.test.js\"",
    "test:watch": "npm run test -- --watch",
    "clean-dist": "npm run remove-dist && mkdir dist",
    "remove-dist": "node_modules/.bin/rimraf ./dist",
    "build:html": "babel-node tools/buildHtml.js",
    "prebuild": "npm-run-all clean-dist test lint build:html",
    "build": "babel-node tools/build.js",
    "postbuild": "babel-node tools/distServer.js"
  },

When I run npm start, I get a long list of error.

npm ERR! System Linux 3.10.0-327.36.3.el7.20161025.20.x86_64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "run" "lint" "--" "--watch"
npm ERR! cwd /home/user/workspace/shareback-viewer
npm ERR! node -v v0.10.30
npm ERR! npm -v 1.4.21
npm ERR! path /home/user/workspace/shareback-viewer/node_modules/lint/package.json
npm ERR! code ENOENT
npm ERR! errno 34......

So clearly the npm script is failing because it's trying to look for the wrong path. npm ERR! path /home/user/workspace/shareback-viewer/node_modules/lint/package.json

How can I fix this?



Solution 1:[1]

Whenever I had this error deleting the node_modules and running npm install in again seems to do the trick, npm start kicks of after that little work-around. I've seem a ton of issues on GitHub about this and most people suggest using the above suggested method. If you see other npm errors you can check the official docs for error troubleshooting. If it still occurs try npm cache clean command, note that you may need to add the --force flag sometimes. Hope this helps!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mirza Sisic