我可以使用git URL在本地安装
How to install an npm package from GitHub directly?
然而,一旦我添加“-g”标志 - 它就失败了。
这是整个日志
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 range-parser@0.0.4 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 fresh@0.1.0 No repository field.
npm http 304 https://registry.npmjs.org/methods/0.0.1
npm WARN package.json methods@0.0.1 No repository field.
npm WARN package.json methods@0.0.1 No readme data.
npm http 304 https://registry.npmjs.org/cookie-signature/1.0.1
npm WARN package.json cookie-signature@1.0.1 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 bytes@0.2.0 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 uid2@0.0.2 No repository field.
npm WARN package.json uid2@0.0.2 No readme data.
npm WARN package.json pause@0.0.1 No repository field.
/usr/bin/express -> /usr/lib/node_modules/express/bin/express
npm WARN package.json cli-table@0.2.0 No repository field.
npm WARN package.json cheerio-select@0.0.3 No repository field.
npm WARN package.json github-url-from-git@1.1.1 No repository field.
npm WARN package.json assert-plus@0.1.2 No repository field.
npm WARN package.json ctype@0.5.2 No repository field.
npm WARN package.json eyes@0.1.8 No repository field.
npm ERR! peerinvalid The package generator-karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer generator-angular@0.3.0 wants generator-karma@~0.3.0
npm ERR! peerinvalid Peer generator-express-angular@0.2.4 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
编辑:
似乎EPEERINVALID
错误与我一直试图完成的事情无关。我全局卸载了“generaotr-express-angular”和“generator-angular”,它起作用了。
我现在的问题是
为什么这个无关的问题影响了我?怎么避免呢?
答案 0 :(得分:3)
即使它失败了,Express仍然按其外观安装。
NPM失败的原因是因为它对本地安装的模块执行完整性检查,并且由于对等体依赖性无效而导致检查失败(解释为here)。该问题可能与Express没有直接关系,但NPM不知道这一点,所以我认为它会假设问题可能导致问题,并且需要解决问题。我还认为你安装的任何软件包,不仅仅是Express,都会触发同样的错误。
正如您已经发现的那样,删除有问题的软件包解决了它(另一种解决方案可能是更新它们,前提是新版本可以解决问题)。他们是如何安装的,我不知道。也许它们安装了一个尚未具有对等依赖性解析的NPM版本。