Reputation: 2525
I'm having trouble installing one of my own dependencies from github.
My package.json looks like this:
{
"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"
}
}
The dependency "graphlib" is causing an error. This is one of my repositories so I'm pretty sure I didn't set it up right. Any help would be appreciated.
I get the following error when running 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! <[email protected]>
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
I have a tag called "v1.1" which is associated with a github release title "v1.1". The package.json for that repository lists "1.1" under the version number field. I have pasted the package.json from that repository here
{
"name": "graphlib",
"description": "Directed graphs in JavaScript using a sparse (adjacency list) representation",
"private": true,
"version": "1.1"
}
Upvotes: 1
Views: 3123
Reputation: 7296
As seen in the repository for GraphLibJS, that project is not set up as a public NPM package. In the package.json
file, indeed, you can see the private: true
flag. This makes NPM ignore that package.
Two possible solutions:
package.json
file so it advertises a public NPM repository. Some help can come from this article.EDIT
My answer was wrong, but the solution is always the same. While it's not true that the private flag makes the package unavailable to NPM, there are certain factors here that influence this.
If you edit your package.json file changing the line to: "graphlib": "git://github.com/Queuecumber/GraphLibJS.git",
Then NPM actually tries to pick up that package on GitHub, but it fails with the following error:
Alessandros-MacBook-Air:test Alessandro$ npm install npm ERR! Error: Invalid version: "1.1" npm 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)
So, my suggestion is still to update the package.json file of the library, by forking it.
Upvotes: 2