OpenStreetMap Carto Tutorials - OpenStreetMap Carto documentation     Site map    
Management procedures for Node.js

Management procedures for Node.js

Install nodejs

sudo apt-get install -y nodejs npm

Remove all node versions

# Remove nvm
sudo rm -rf ~/.nvm
hash -r

# Remove latest node version
sudo npm uninstall -g n

# Remove n
cd ~/src/n && sudo make uninstall && cd .. && sudo rm -r n

# Remove latest nodejs version
sudo apt-get purge -y nodejs npm

# Remove nodejs-legacy version
sudo apt-get purge -y nodejs-legacy npm

sudo apt -y autoremove

# Remove nodejs files
sudo rm -rf /usr/local/lib/node_modules/npm
sudo rm -rf /usr/local/lib/node_modules/n
sudo rm -f /usr/local/bin/node
sudo rm -f /usr/local/bin/npm
sudo rm -f /usr/bin/node
sudo rm -rf /usr/local/n/versions/node

node legacy

Install node legacy

Any updated node version shall be uninstalled before installing nodejs-legacy.

sudo apt-get install -y nodejs-legacy npm

Remove node legacy

sudo apt-get purge -y nodejs-legacy npm
sudo apt -y autoremove
exit # close the session and restart to clear the path

n

Install n

cd ~/src
git clone https://github.com/tj/n.git
cd n
sudo make install
cd ..

Install node with n

sudo n lts

Completely uninstall n

cd ~/src/n
sudo make uninstall
cd ..
sudo rm -r n

Install nodejs, node and npm

sudo apt-get install -y nodejs npm

sudo npm cache clean -f
sudo npm install -g n
sudo n lts
exit # close the session and restart to clear the path

Check current versions

nodejs -v
node -v
npm -v

nvm

Install nvm

cd ~/
git clone https://github.com/creationix/nvm.git .nvm
cd ~/.nvm
git checkout v0.33.9
. nvm.sh

Install the latest version of node with nvm

nvm install node
nvm install v4.2.6
nvm install lts/argon

nvm use node # use the last node version
nvm use v4.2.6 # use nodejs-legacy

nvm install v6.14.1

Switch to a node version with nvm

nvm use v6.14.1

List the local node versions with nvm

nvm ls

List the installable node versions with nvm

nvm ls-remote

Remove nvm

sudo rm -rf ~/.nvm
hash -r

Reinstall a local node package

cd <directory where the node application is located>
sudo rm -rf node_modules
sudo rm -rf /usr/local/lib/node_modules/<package>
npm install

Install global node package for all users

cd <directory where the node application is located>
sudo rm -rf /usr/local/lib/node_modules/<package>
sudo rm -rf node_modules
sudo npm install -g

Read node.js for further information.


Please, avoid using Disqus below to notify issues on this page, just use it for general comments. Create a GitHub issue instead. This is the most effective way to track problems.
comments powered by Disqus