guy mograbi
guy mograbi

Reputation: 28708

nodejs npm unable to install globally from github URL

I am able to install locally using a git URL

How to install an npm package from GitHub directly?

however, once I add "-g" flag - it fails.

Here is the entire log

guym@guym-ubuntu:~/dev_env/projects_GIT/cosmo/gs-tmp$ sudo npm -g install git://github.com/visionmedia/express.git
npm http GET https://registry.npmjs.org/connect/2.8.3
npm http GET https://registry.npmjs.org/commander/1.2.0
npm http GET https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/mkdirp/0.3.5
npm http GET https://registry.npmjs.org/cookie/0.1.0
npm http GET https://registry.npmjs.org/buffer-crc32/0.2.1
npm http GET https://registry.npmjs.org/fresh/0.1.0
npm http GET https://registry.npmjs.org/methods/0.0.1
npm http GET https://registry.npmjs.org/cookie-signature/1.0.1
npm http GET https://registry.npmjs.org/send/0.1.2
npm http GET https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/connect/2.8.3
npm http 304 https://registry.npmjs.org/range-parser/0.0.4
npm WARN package.json [email protected] No repository field.
npm http 304 https://registry.npmjs.org/cookie/0.1.0
npm http 304 https://registry.npmjs.org/commander/1.2.0
npm http 304 https://registry.npmjs.org/mkdirp/0.3.5
npm http 304 https://registry.npmjs.org/buffer-crc32/0.2.1
npm http 304 https://registry.npmjs.org/fresh/0.1.0
npm WARN package.json [email protected] No repository field.
npm http 304 https://registry.npmjs.org/methods/0.0.1
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No readme data.
npm http 304 https://registry.npmjs.org/cookie-signature/1.0.1
npm WARN package.json [email protected] No repository field.
npm http 304 https://registry.npmjs.org/send/0.1.2
npm http 304 https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/keypress
npm http GET https://registry.npmjs.org/qs/0.6.5
npm http GET https://registry.npmjs.org/formidable/1.0.14
npm http GET https://registry.npmjs.org/bytes/0.2.0
npm http GET https://registry.npmjs.org/uid2/0.0.2
npm http GET https://registry.npmjs.org/pause/0.0.1
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/qs/0.6.5
npm http 304 https://registry.npmjs.org/bytes/0.2.0
npm WARN package.json [email protected] No repository field.
npm http 304 https://registry.npmjs.org/formidable/1.0.14
npm http 304 https://registry.npmjs.org/uid2/0.0.2
npm http 304 https://registry.npmjs.org/pause/0.0.1
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No readme data.
npm WARN package.json [email protected] No repository field.
/usr/bin/express -> /usr/lib/node_modules/express/bin/express
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm ERR! peerinvalid The package generator-karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants generator-karma@~0.3.0
npm ERR! peerinvalid Peer [email protected] wants generator-karma@~0.2.0

npm ERR! System Linux 3.8.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "-g" "install" "git://github.com/visionmedia/express.git"
npm ERR! cwd /home/guym/dev_env/projects_GIT/proj/somename
npm ERR! node -v v0.10.10
npm ERR! npm -v 1.2.25
npm ERR! code EPEERINVALID
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/guym/dev_env/projects_GIT/proj/somane/npm-debug.log
npm ERR! not ok code 0

EDIT :

Seems that EPEERINVALID error has nothing to do with what I have been trying to accomplish. I globally uninstalled "generaotr-express-angular" and "generator-angular" and it worked.

My question now is

Why did this unrelated problem affected me? How to avoid it?

Upvotes: 2

Views: 3360

Answers (1)

robertklep
robertklep

Reputation: 203514

Even though it fails, Express was still installed by the looks of it.

The reason NPM fails is because it performs a sanity check of your locally installed modules, and that check fails because of an invalid peer dependency (explained here). That issue might not be directly related to Express, but NPM doesn't know that so I think it will assume that the issue might cause problems and it will require the issue to be resolved. I also think that any package you would have installed, not just Express, would have triggered the same error.

As you already found out, removing the offending packages solves it (another solution might have been to update them, provided that newer versions fix the problem). How they got installed in the first place, I don't know. Perhaps they were installed with an NPM-version that didn't yet have peer dependency resolution.

Upvotes: 3

Related Questions