How do you reinstall an app's dependencies usi

2019-01-29 18:13发布

问题:

Is there a simple way to reinstall all packages that my app depends on (i.e. they are in my apps node_modules folder)?

回答1:

The easiest way that I can see is delete node_modules folder and execute npm install.



回答2:

Right way is to execute npm update. It's a really powerful command, it updates the missing packages and also checks if a newer version of package alreaddy installed can be used.

Read Intro to NPM to understand what you can do with npm.



回答3:

Most of the time I use the following command to achieve a complete reinstall of all the node modules (be sure you are in the project folder).

rm -rf node_modules && npm install

You can also run npm cache clean after removing the node_modules folder to be sure there aren't any cached dependencies.



回答4:

npm updated the install CLI command and added the --force flag

The -f or --force argument will force npm to fetch remote resources even if a local copy exists on disk.

npm install



回答5:

You can use the reinstall module found in npm.

After installing it, you can use the following command:

reinstall

The only difference with manually removing node_modules folder and making npm install is that this command automatically clear npm's cache. So, you can get three steps in one command.



标签: node.js npm