Install NodeJS without sudo on Ubuntu

I have already followed node -and-npm-in-30-seconds.sh .

I used to use the AngularJS application using Yeoman and bower with NodeJS. At that time, I used sudo to install everyone.

Here is what I followed

sudo apt-get install python-software-properties python g++ make sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs sudo apt-get install git-core 

I recently tried to create an AngularJS application, but it did not build properly. Then I discovered that I should not use sudo when installing nodejs, yeoman and Bower.

I searched and found a solution here node -and-npm-in-30-seconds.sh .

So first I removed NodeJS

 sudo apt-get remove nodejs 

Then followed the first parameter specified in the link

 echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc . ~/.bashrc mkdir ~/local mkdir ~/node-latest-install cd ~/node-latest-install curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 ./configure --prefix=~/local make install # ok, fine, this step probably takes more than 30 seconds... curl https://www.npmjs.org/install.sh | sh 

The last command does not work. He showed

 $ curl https://www.npmjs.org/install.sh | sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 51 100 51 0 0 63 0 --:--:-- --:--:-- --:--:-- 63 sh: 1: Moved: not found 

I googled and tried the following from this SO answer

 curl -O -L https://npmjs.org/install.sh sh install.sh 

The following error is displayed

 npm cannot be installed without node.js. Install node first, and then try again. Maybe node is installed, but not in the PATH? Note that running as sudo can change envs. PATH=/home/myuser/local/bin:/usr/lib/jvm/java-7-oracle/bin:/usr/lib/jvm/java-7-oracle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games 

Why is that? And how can I solve this? Thank you

+5
source share
1 answer

Ok, I tried it and worked for me

 echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc . ~/.bashrc mkdir ~/local mkdir ~/node-latest-install cd ~/node-latest-install curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 ./configure --prefix=$HOME/local make install curl -L https://www.npmjs.com/install.sh | sh 
+6
source

All Articles