0
$ sudo apt-get install python g++ make
$ wget http://nodejs.org/dist/node-latest.tar.gz
$ tar xvfvz node-latest.tar.gz
$ cd node-v0.10.21 (replace a version with your own)
$ ./configure
$ make
$ sudo make install

I keep getting:

#nodejs --version   
/usr/bin/nodejs: No such file or directory

I understand though, everything seems to be installed here:

installing /usr/local/bin/node

How do i fix this?

Many thanks! I am very new to linux and how this all works.

By the way: apt-get install nodejs does work but it does not install version 0.12.

In addition, if i try npm it also cant find it.

ADL
  • 2,707
  • 1
  • 16
  • 23

3 Answers3

1

sudo ln -s /usr/local/bin/node /usr/sbin/node

Just had to fix paths.

ADL
  • 2,707
  • 1
  • 16
  • 23
  • A better fix would be to add `/usr/local/bin` to your `PATH`. https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux – Felix Kling Mar 07 '15 at 19:54
1

It seems like /usr/local/bin is not in your PATH and thus the executable cannot be found. Add it to your PATH as described in How to permanently set $PATH on Linux?.

If you just link the one executable, you will have the same problem with any other executable added to /usr/local/bin.

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
  • I will mark your answer correct if you can further explain why its a better fix to add to my path instead of -s. – ADL Mar 09 '15 at 22:08
0

npm -v is not working in your system just do this

open my computer or this pc

  • right click & select properties

  • click on advanced system settings in advanced tab click on environment variables

  • in system variable remove semicolon from ComSpec

    C:\Windows\system32\cmd.exe;

  • change this as

    C:\Windows\system32\cmd.exe


Now it will work..

satish e
  • 1
  • 2