mrfr
mrfr

Reputation: 1794

How to restore deleted 'node_modules' folder?

On Ubuntu 16.04 I accidently deleted the 'node_modules' folder so that I can't run npm anymore. I get the error:

bash: /usr/local/bin/npm: No such file or directory.

How can I fix this?

Upvotes: 3

Views: 19825

Answers (3)

BILLA
BILLA

Reputation: 194

just type npm i in your project and nodemodule will install .

Upvotes: 0

its4zahoor
its4zahoor

Reputation: 1811

If package.json is present in your project directory, which usually is, then run npm install and all the packages will be restored as well as the node_modules directory, where they are stored.

Upvotes: 12

Pezzer
Pezzer

Reputation: 670

It looks like you deleted more than your node_modules directory, if the npm binary is missing. Just Reinstall Node.js/npm.

Upvotes: 3

Related Questions