Actually, I do not have many opportunities to work with NodeJS. However, sometimes, I have to deploy some applications that request to install some npm packets. So easy with “npm install”. But what you think if npm command get errors? I think that it is time you need to upgrade NPM to the latest version.
It is really simple with commands bellow:
1 2 3 4 5 6 7 8 |
# update to latest npm install -g npm@latest # check version npm -v # remove cache of the old version npm cache clean && rm -rf node_modules # run npm install for your app npm install |
Update Node to latest version:
1 2 3 |
sudo npm cache clean -f sudo npm install -g n sudo n stable |
Finally, link node executed file to /usr/bin/node:
1 |
sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/node |