All I wanted was just to install nodejs…and npm…

Well recently, It happens that I need to update my nodejs package on my ubuntu server (18.04.2). I type node -v and see that it is v8.x something and the LTS version now is 10.16.3, so I set out to upgrade it. After following some simple guides online, I simply can’t get it to work. Even after I installed the latest nodejs, the version checking still gives me the old version with both node and npm. WTH!

Without the time to dive in and find out what is the culprit, I completely removed previous node and npm stuff on my ubuntu using good old sudo rm -rf node-shit following this guide

Then I see many guides say that you have to first execute

curl -sL | sudo -E bash -

before running this

sudo apt-get install -y nodejs

So, firstly after running the curl command above, there’s a line of text near the end saying ## Run `sudo apt-get install -y nodejs` to install Node.js 10.x and npm. So then I run sudo apt-get install -y nodejs, and nodejs -v gives me 10.16.3. Great! Next I do npm -v, well…the console gives out

-bash: /usr/local/bin/npm: No such file or directory

Shit! WTH! Even more bad news, I can’t even get the nvm approach to install my node and npm as well…I’m starting to doubt that it is my server’s peculiar case but not that those guides have failed others.

After two hours of trying, finally I saw the holy light in the dark! is my ultimate lifesaver.

I have to follow its “Installing Using a PPA” approach in order to make things work. God bless the guy who wrote this guide! I guess the magic in this working approach is in its file. I really hope that this can save someone who is in the same weird shit situation that I once was.

Published by Mageek

Just another geek in the world

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: