The One
The One

Reputation: 21

How to get NPM working on Linux

I've been using node.js and npm on Windows for some time and everything worked well, untill I tried to do the same thing on linux.

My goal:

Use node.js along with npm on linux.

What I did:

I downloaded tar.gz file from node.js website and I unpacked it. I have a folder (that unpacked tar.gz) and my guess is that that's it, seems I just need to run "node" file from node.js/bin/ folder to execute javascript files.

I never really thought about what this "npm" really is, on Windows I would simply run cmd from xampp, write npm install and everything would work fine. I found some link to npm-cli.js file in the same folder where "node" file is. I guess what used to be "npm install ..." now is "node npm install ..." since it's a js file.

I am confused about where exactly packages are supposed to be installed. There are few node_modules folders and when I run node npm install a progress bar appears and gets stuck right away, nothing happens.

So I have 2 problems

I've looked some tutorials but there is no "./configure" file, make install etc doesn't work.

I'm new to linux so I'm probably making some obvious mistakes. Can someone explain this to me?

Upvotes: 2

Views: 119

Answers (1)

Sven
Sven

Reputation: 5265

For development on Linux or OSX I suggest using nvm instead of getting the binaries. Linux and OSX are a bit different from Windows in a sense that you don't always need to install programs as the compiled binaries themselves are usually enough.

To install, open a Terminal and paste:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash

restart the terminal to make sure you reload the configuration or source your config, then run:

nvm install v5.7.0
nvm alias default v5.7.0

And you're done!

Upvotes: 1

Related Questions