我无法从github安装我自己的一个依赖项。
我的package.json看起来像这样:
{
"name": "smartorm",
"description": "Intelligent multi-database object relational mapping",
"private": true,
"main": "smart.js",
"dependencies": {
"mysql": "~2.5.0",
"graphlib": "Queuecumber/GraphLibJS#v1.1",
"promise": "~6.0.0",
"xtend": "Raynos/xtend#v4.0.0"
}
}
依赖" graphlib"导致错误。这是我的一个存储库,所以我很确定我没有正确设置它。任何帮助将不胜感激。
运行npm install
npm http 304 https://registry.npmjs.org/graphlib
npm ERR! Error: No compatible version found: graphlib@'Queuecumber/GraphLibJS#v1.1'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.6","0.1.0","0.1.1","0.2.0","0.2.1","0.3.0","0.3.1","0.3.2","0.3.3","0.4.0","0.4.1","0.4.2","0.5.0","0.5.1","0.5.2","0.5.3","0.5.4","0.5.5","0.5.6","0.5.7","0.5.8","0.5.9","0.5.10","0.5.11","0.5.12","0.6.0","0.7.0","0.7.1","0.7.2","0.7.3","0.7.4","1.0.0-pre1","0.8.0"]
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:719:10)
npm ERR! at /usr/share/npm/lib/cache.js:638:10
npm ERR! at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.13.0-36-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /media/Data/Code/Active/SmartORM
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /media/Data/Code/Active/SmartORM/npm-debug.log
npm ERR! not ok code 0
我有一个名为&#34; v1.1&#34;这与github发布标题&#34; v1.1&#34;相关联。 该存储库的package.json列出&#34; 1.1&#34;在版本号字段下。我已经从这个存储库粘贴了package.json
{
"name": "graphlib",
"description": "Directed graphs in JavaScript using a sparse (adjacency list) representation",
"private": true,
"version": "1.1"
}
答案 0 :(得分:2)
如repository for GraphLibJS所示,该项目未设置为公共NPM包。实际上,在package.json
文件中,您可以看到private: true
标志。这使得NPM忽略了该包。
两种可能的解决方案:
package.json
文件,以便它公布一个公共NPM存储库。一些帮助可以来自this article。修改强>
我的回答是错的,但解决方案总是一样的。虽然私有标志使得NPM无法使用该软件包,但这里有一些因素会对此产生影响。
如果您编辑package.json文件,请将该行更改为:
"graphlib": "git://github.com/Queuecumber/GraphLibJS.git",
然后NPM实际上尝试在GitHub上获取该包,但它失败并出现以下错误:
Alessandros-MacBook-Air:测试Alessandro $ npm install 错误的ERR!错误:版本无效:&#34; 1.1&#34; 错误的ERR! at Object.module.exports.fixVersionField(/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:183:13)
所以,我的建议仍然是通过分支来更新库的package.json文件。