Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the system version of nodejs - ubuntu

I just started to use node.js in local projects few days ago. My application works good, if I run it from command shell

nvm run 0.10.32 ./bin/www app

or

node ./bin/www app

So, it works with node version 0.10.xx or higher. But there is a problem: I can't debug it from WebStorm - it throws lots of errors. I went to settings and was stunned: "Node.js core modules version is 0.6.12". Then, I've checked the installed versions of node and it returns

user@user-VirtualBox:~/$ nvm ls

-> v0.10.24 v0.10.32 system

and when I type

nvm use system

it says,

/home/user/.nvm/*/bin removed from $PATH
/home/user/.nvm/*/share/man removed from $MANPATH
/home/user/.nvm/*/lib/node_modules removed from $NODE_PATH
Now using system version of node: v0.6.12.

Obviously, I need to change the system version of nodejs. I tried to update, remove, reinstall - no results, it still has this version. All I need is being able to debug my application code from webstorm. How can I get it - change system version of node, or maybe another ways? Any tips would be very helpful.

like image 715
Vladimir Tagai Avatar asked Oct 28 '14 09:10

Vladimir Tagai


People also ask

How do I change node js version in Ubuntu?

If you ever need to switch node versions, you can simply run nvm use <version-number> , for example nvm use v12. 18.1 . To list the different node versions you have installed with nvm, run nvm ls .


1 Answers

Verify that default node is really coming from nvm with which node, if its not, you can safely run :

rm `which node`

To set the default node version with nvm use :

nvm alias default 0.10.32

If you have many apps that use different node version, add a .npmrc in the root directory in each of them. .npmrc only contains the version, e.g. "v0.10.32".

Then each time you cd into a project run

nvm use
like image 140
FGRibreau Avatar answered Oct 04 '22 21:10

FGRibreau