NPM: no such file or directory
I'm using Ubuntu 16.04
I removed NPM in order to install older version. (I can't exactly command which I used).
now I can't install it again.
npm -v output:
bash: /usr/bin/npm: /usr/bin/nodejs: bad interpreter: No such file or directory
which npm output:
curl -L http://npmjs.org/install.sh | sudo sh
`install npm@latest fetching: https://registry.npmjs.org/npm/-/npm-5.5.1.tgz module.js:544 throw err; ^ Error: Cannot find module '/tmp/npm.9881/package/bin/read-package-json.js' at Function.Module._resolveFilename (module.js:542:15) at Function.Module._load (module.js:472:25) at Function.Module.runMain (module.js:682:10) at startup (bootstrap_node.js:191:16) at bootstrap_node.js:613:3 up to date in 0.059s /usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js + firstname.lastname@example.org added 1 package in 1.907s It worked`
UPD: Solved. Remove node/nodejs/npm completely and remove all relative folders a then reinstall via NVM helped. https://www.digitalocean.com/community/tutorials/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps
Better way to install nodejs is via nvm. Here you can install/use multiple version of nodejs in a machine.
nvm install $vesionNo nvm use $versionNO // for default nvm alias default node
@kevinhaas MWB (MalWareBytes) is a symptom to a deeper problem, the larger issue has to do with "no such file or directory" on *nix systems or that the actual error message is much too generic to troubleshoot. I am sure the npm team (more specifically @iarna) is aware of this.
In some Linux distributions, node is installed on
/usr/bin/nodejs and not on
What I did, is install nodejs-legacy, and it solved the problem. It creates a symlink from
So, what I recommend (as the easiest solution) is to install
sudo apt-get install nodejs-legacy
npm ERR! enoent ENOENT: no such file or directory, chmod '/node_modules/rollup/dist/bin/rollup.js' npm ERR! enoent This is related to npm not being able to find a file.
If there is a character or a space other than the English characters from the windows user name, it can also be caused by this.
I'm talking about the installation of global packages. If you are installing a package on a specific project, it may also be caused by the lack of package.json.
npm ERR! path D:\TutsGalaxy\angular-and-node\package.json npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open 'D:\TutsGalaxy\angular-and-node\package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR!
Try this command:
sudo npm install -g npm@latest
For latest version or otherwise:
sudo npm install -g npm@<version_no_here>
For specific version.
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\risha\Desktop\Front End Web UI Frameworks and Tools Bootstrap 4\git-test ode_modules\lite-server' -> 'C:\Users\risha\Desktop\Front End Web UI Frameworks and Tools Bootstrap 4\git-test ode_modules.lite-server.DELETE'
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\THE_USERNAME pm-temp pm-THE_HASH' All commands were run as Administrator, so I had full permissions. Then I thought there were some issues with existing files so I ran:
If Googling "no such file or directory package.json" sent you here, then you might be using a very old version of Node.js The following page has good instructions of how to easily install the latest stable on many Operating systems and distros:
I've had this same problem when building with email@example.com for several of our company repos. When I remove package-lock.json before running npm install it works without problems, but when I keep package-lock.json it does not always work.
- I don't need to install nvm or nodejs. I have problem with npm
- npm comes with nodejs you don't need install them separately I think.
Reading package lists... Done Building dependency tree Reading state information... Done nodejs-legacy is already the newest version (4.2.6~dfsg-1ubuntu4.1). 0 upgraded, 0 newly installed, 0 to remove and 78 not upgraded.
- Try the following commands
whereis nodeand where is
nodejsand print here the output
node: /usr/bin/node /usr/local/bin/node /usr/share/man/man1/node.1.gz
nodejs: /usr/bin/nodejs /usr/lib/nodejs /usr/include/nodejs /usr/share/nodejs /usr/share/man/man1/nodejs.1.gzOne more time: I have problem with NPM installing, I don't care about node/nodejs right now.
sudo: unable to execute /usr/bin/npm: No such file or directory Hangup
- try installing by
sudo apt-get install npm. If this also doesn't work then try installing node again. Follow this: digitalocean.com/community/tutorials/…
- You cannot run
sudo npm install -g npm@latestsince the nmp does not exist in the system.