简体   繁体   中英

I am not able to install nodejs 8 on ubuntu

I have nodejs version v4.2.6 on my ubuntu machine. If I try to upgrade to v8 or try to remove and install v8 , then still v4.2.6 is installed on my machine.

I removed the older version.

sudo apt-get remove nodejs 
sudo apt-get remove npm 
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules 
sudo rm -rf /usr/local/lib/node* 
sudo rm -rf /usr/local/include/node* 
sudo rm -rf /usr/local/bin/node*

Then installed v8:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs

But still, I have node v4.2.6

Can you please tell me how to upgrade to v8 .

You can use nvm to update your node version on Ubuntu.

  1. Install nvm
  2. Follow David Walsh blog post

At any given time you can switch to another with use:

nvm use 0.12

If you want to check out what versions of Node.js are installed on your machine, you can use the ls option:

nvm ls

/*
        v0.10.26
        v0.10.36
->      v0.12.7
        v4.2.1
        system
*/

If you're done with a version and want it gone, you can do that too:

nvm uninstall 0.10*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM