Forum Topic

Viewing a single forum discussion topic.

Back to Programming Errors And Help

Don't know which version of node I am runnig

Post a reply
388 views
DeepikaPatil
DeepikaPatil

I need to run a node script that requires a node version greater than 4.3.0. When I try to run the script something goes wrong, i.e. part of the output:

WARN engine enhanced-resolve@3.1.0: wanted: {"node":">=4.3.0 <5.0.0 || >=5.10"} (current: {"node":"4.2.6","npm":"3.5.2"})
WARN engine loader-runner@2.3.0: wanted: {"node":">=4.3.0 <5.0.0 || >=5.10"} (current: {"node":"4.2.6","npm":"3npm WARN lifecycle utf-8-validate@3.0.1~install: cannot run in wd %s %s (wd=%s) utf-8-validate@3.0.1 prebuild-install || node-gyp rebuild /home/diego/work/creditgate24/kloten-tegel/tegel/tegel/node_modules/utf-8-validate

I thus checked the current version:

$node -v
v4.2.6

but if I run:

$nvm ls
         v7.4.0
->       system
node -> stable (-> v7.4.0) (default)
stable -> 7.4 (-> v7.4.0) (default)
iojs -> iojs- (-> N/A) (default)

I am new to node and nvm. Which version I am actually running? If 4.2.6 how could I upgrade it? thanks

mayureshpandit282
mayureshpandit282

Your current version is v2.4.6.

Here are the steps to upgrade via npm:

Clean Cache Fully

username@pcname:~$ sudo npm cache clean -f

npm WARN using --force I sure hope you know what you are doing.

Install n Module

username@pcname:~$ sudo npm install -g n 

/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
n@2.0.2 /usr/local/lib/node_modules/n

Install Latest Release of Node

username@pcname:~$ sudo n stable 

 install : node-v6.0.0
   mkdir : /usr/local/n/versions/node/6.0.0
   fetch : https://nodejs.org/dist/v6.0.0/node-v6.0.0-linux-x64.tar.gz
############################################################ 100.0%
installed : v6.0.0

Setup Binary Link – Now link your node binary with latest node installed binary file using following command.

username@pcname:~$ sudo ln -sf /usr/local/n/versions/node/6.0.0/bin/node /usr/bin/node

Check your version of node - Should be latest version.

username@pcname:~$ node -v 

v6.0.0

You should now be able to run your script.

1-2 of 2

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.