tj / n

Node version management
MIT License
18.8k stars 738 forks source link

Error: no installed version #285

Closed islearning closed 9 years ago

islearning commented 9 years ago

Ubuntu Kylin 15.4

I install n, but there's something wrong when I update my nodejs:

frey1991@frey1991-Satellite-M800:~$ which -a node /home/frey1991/myinstall/nodejs/node-v0.10.36-linux-x64/bin/node frey1991@frey1991-Satellite-M800:~$ n --version mkdir: cannot create directory ‘/usr/local/n’: Permission denied mkdir: cannot create directory ‘/usr/local/n’: Permission denied 1.3.0 frey1991@frey1991-Satellite-M800:~$ yo --version 1.4.7 frey1991@frey1991-Satellite-M800:~$ npm list -g --depth=0 /home/frey1991/myinstall/nodejs/node-v0.10.36-linux-x64/lib ├── bower@1.4.1 ├── fe-interview@2.0.0 ├── generator-angular@0.11.1 ├── generator-karma@1.0.0 ├── generator-mocha@0.1.8 ├── generator-webapp@0.5.1 ├── grunt-cli@0.1.13 ├── n@1.3.0 ├── npm@2.11.2 └── yo@1.4.7

frey1991@frey1991-Satellite-M800:~$ n mkdir: cannot create directory ‘/usr/local/n’: Permission denied mkdir: cannot create directory ‘/usr/local/n’: Permission denied find: `/usr/local/n/versions': No such file or directory

Error: no installed version

frey1991@frey1991-Satellite-M800:~$ sudo n node latest sudo: n: command not found

ghost commented 9 years ago

It looks like you downloaded and unpacked a node tar file directly? And you then added the bin folder to your PATH?

no installed version is correct because there are no node versions managed by n yet.

An easy way, for Ubuntu, to work with n and not get the /usr/local message is to setup a bin folder under your $HOME directory and then add export N_PREFIX=$HOME to your shell .profile file.

Then run n latest which will get and setup the newest version of node for you.

islearning commented 9 years ago

@tedgaydos, I added export N_PREFIX=$HOME to my shell .profile file and it works, but the current node's version is still v0.10.36. Should I add the new node folder to my PATH and reinstall all my npm package?

frey1991@frey1991-Satellite-M800:~$ n latest

     install : node-v0.12.4
       mkdir : /home/frey1991/n/versions/node/0.12.4
       fetch : https://nodejs.org/dist/v0.12.4/node-v0.12.4-linux-x64.tar.gz
   installed : v0.10.36

frey1991@frey1991-Satellite-M800:~$ node -v
v0.10.36
ghost commented 9 years ago

Make sure that your ~/bin folder is at the front of your PATH. That way the node installed by n will take precedence. Sometimes after installing the first time from n, loading a new terminal window will take care of it. Ubuntu will add ~/bin to the front of the PATH automatically if one is present.

islearning commented 9 years ago

Thanks, it works! @tedgaydos