Question

I've node,js properly installed from source and I'm trying to install npm but I'm receiving errors doesn't matter the method.

I followed this link primarily: Installing Node and Npm from source

If I try clone the npm repository and after proceed with make install i got this error message:

scripts/doc-build.sh: line 58: ./node_modules/.bin/marked: No such file or directory
make: *** [html/doc/api/npm-uninstall.html] Error 1

If i choose to install from source with sript (wget or curl) I got the errors bellow (with http or https, doesn't matter):

wget http://npmjs.org/install.sh                                 
--2014-05-13 00:52:25--  http://npmjs.org/install.sh
Connecting to 127.0.0.1:8118... failed: Connection refused.

If I try to use curl I receive this another error message:

curl https://npmjs.org/install.sh | sh
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) couldn't connect to host

And If I try to install using sudo apt-get install npm I receive this error:

The following packages have unmet dependencies:
 npm : Depends: nodejs but it is not going to be installed
       Depends: nodejs-dev
       Depends: node-request but it is not going to be installed
       Depends: node-mkdirp but it is not going to be installed
       Depends: node-minimatch but it is not going to be installed
       Depends: node-semver but it is not going to be installed
       Depends: node-ini but it is not going to be installed
       Depends: node-graceful-fs but it is not going to be installed
       Depends: node-abbrev but it is not going to be installed
       Depends: node-nopt but it is not going to be installed
       Depends: node-fstream but it is not going to be installed
       Depends: node-rimraf but it is not going to be installed
       Depends: node-tar but it is not going to be installed
       Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
node -v                                                     
v0.11.14-pre

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.4 LTS
Release:    12.04
Codename:   precise


which node
/home/user/local/node/node

I don't know what more I can do tho fi this issue that I'm in trouble for entire day yesterday until now.

thanks if someone could help me with this.

Was it helpful?

Solution 2

I had the same problems which you faced. As for the last dependency problem go /etc/apt/sources.list.d and delete any node related list if you have any. If you come back and install npm you wont get any dependency problem.

But I would strongly recommend don't install npm using apt-get. Its comes by default in nodejs when you follow the instructions from nodejs website (via package manager). There is another catch here. You need sudo permission to install nodejs by this method. And you will face problem in future if you use sudo to install nodejs and npm. Read this to understand how to install node properly in dev machine and production machine.

Always use nvm to install nodejs and npm in dev machine. By this way you can avoid using sudo while install other tools from npm like yo, grunt, bower.

In short,

  1. Install NVM using this link
  2. Install nodejs using NVM. NPM comes by default with nodejs.

OTHER TIPS

AFAIK, npm is installed along with the node binary when you install nodejs package.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top