Complètement désinstaller nodejs et npm et tout réinstaller via nvm
Testé et validé! La méthode ci-dessous fonctionne à condition de bien supprimer à la main l’ensemble des fichiers et dossiers listés.
Source: Completely removing Node.js and Npm et la version PDF pour la postérité.
Removing Node.js
To recap, the best way (I’ve found) to completely uninstall node + npm is to do the following:
- go to /usr/local/lib and delete any node and node_modules
- go to /usr/local/include and delete any node and node_modules directory
- if you installed with brew install node, then run brew uninstall node in your terminal
- check your Home directory for any « local » or « lib » or « include » folders, and delete any « node » or « node_modules » from there
- go to /usr/local/bin and delete any node executable
You may need to do the additional instructions as well:
- remove: /usr/local/bin/npm
- remove: /usr/local/share/man/man1/node.1
- remove: /usr/local/lib/dtrace/node.d
- execute: rm -rf /Users/[homedir]/.npm
Ré-installer nodejs avec nvm
Then download nvm and follow the instructions to install node. The latest versions of node come with npm, I believe, but you can also reinstall that as well
Attention: une fois nvm installé via le commande curl ou wget, taper la commande source ~/.profile
dans le terminal pour rendre nvm accessible via la commande nvm
(source: How to Install NVM (Node Version Manager) for Node.js on Ubuntu 12.04 LTS).
Node still isn’t uninstalled!
Dans mon cas, les deux premières manips décrites dans ce billet ont suffit. Si ce n’est pas votre cas, poursuivez avec les manips décrites ci-dessous.
If you have done the above and you can still execute node on your terminate by firing node
then you might need to do the following. Download the source code from nodejs.org exactly like how you have installed your nodejs from source.
1 2 3 4 5 |
git clone git://github.com/ry/node.git cd node ./configure make sudo make install |
Inside the source code, instead of hitting ‘make’ and ‘make install’, do the following
1 |
sudo make uninstall |
This instruction will uninstall whatever the source has installed into your machine.
Node and Npm still not uninstalled
Well, if you did all the above and you can still use node on your machine. You might want to try using ‘locate’ and manually removing all the necessary npm and node files in your machine by using
1 2 |
locate node locate npm |
after you remove anything from the above command, you should fire the following to update the latest locate database
1 |
sudo /usr/libexec/locate.updatedb |
but you will have the fire the above command every time you successfully remove certain directory as ‘locate’ only update periodically at a specific time every day.
Si la solution ci-dessus n’a pas fonctionné, vous pouvez toujours tenter les solutions ci-dessous:
Nouvelle solution
Passer en mode root en tapant sudo su
. Puis taper la ligne suivante: curl -L https://www.npmjs.com/install.sh | sh
.
Problème!
Attention: passer en mode root va updater NPM en mode root uniquement… Si l’on sort de ce mode (commande exit
), la commande npm -v
nous donne toujours la version précédente.
Commencer par essayer ceci:
Source: How to Install Latest Node.js and NPM on Ubuntu with PPA. Version PDF pour la postérité: tecadmin.net-How to Install Latest Nodejs and NPM on Ubuntu with PPA.