By bdsk
I upgraded a one-click node.js ubuntu 14.04 image to ubuntu 16.04.
The default node version is v4.2.1 and it is the old one on my 14.04 image. This old node executable is located on /usr/local/bin/. The newer node which comes with Ubuntu 16 is v4.6 and it is located on /usr/bin. I would like v4.6 to be the default node.js.
In my PATH variable, I discover that /usr/local/bin/ comes before /usr/bin. I think the solution would be to move /usr/bin before /usr/local/bin to use v4.6 as default node.js.
How can I modify PATH variable so that /usr/bin comes before /usr/local/bin? The order needs to be changed.
Thank you.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You should try writing PATH variable to .bashrc file.
It’s located under your home directory, open your with any text editor:
- nano ~/.bashrc
In try to locate does you have line that begins with:
export PATH=
If you don’t have it it in file, feel free to add it. In your case it should be like
export PATH=/usr/local/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/sbin:/bin:/usr/games:/usr/local/games
Save it and close editor. You can log out and log in again or use command to refresh it:
- source ~/.bashrc
Try getting PATH from terminal and see if it is correct.
If you still get problem, maybe you should try removing nodejs package and checking is there node package. Then install by any method you want. If you want better version control, check nvm solution
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.