简体   繁体   中英

Unable to install local modules in package.json dependency list. Defined by file path

I have the following package.json at the root of my app.

....
"dependencies": {
"LessonApi": "file:apis/lesson",
"SearchAPI": "file:apis/search",
"SlotApi": "file:apis/slots",
"UserAPI": "file:apis/user",
"bcrypt": "^0.8.3",
"co": "^4.5.4",
"co-mysql": "^1.0.0",
"koa": "^0.20.0",
"koa-basic-auth": "^1.1.2",
"koa-bodyparser": "^2.0.0",
"koa-cors": "0.0.16",
"koa-generic-session": "^1.9.0",
"koa-mount": "^1.3.0",
"koa-passport": "^1.1.6",
"koa-router": "^5.1.2",
"koa-session": "^3.3.0",
"mysql": "^2.7.0",
"passport-facebook": "^2.0.0",
"sql-fixtures": "^0.11.0"
},
.....

I have a custom module at /apis/lesson. But as soon as I do npm install at the root of the app it fails and gives me this error.

git clone git@github.com:file:apis/slots Cloning into bare repository '/root/.npm/_git-remotes/git-github-com-file-apis-slots-6576eaee'...
npm ERR! git clone git@github.com:file:apis/slots fatal: remote error: 
npm ERR! git clone git@github.com:file:apis/slots    is not a valid repository name
npm ERR! git clone git@github.com:file:apis/slots   Email support@github.com for help
npm ERR! git clone git@github.com:file:apis/lesson Cloning into bare repository '/root/.npm/_git-remotes/git-github-com-file-apis-lesson-7b1b575f'...
npm ERR! git clone git@github.com:file:apis/lesson fatal: remote error: 
npm ERR! git clone git@github.com:file:apis/lesson    is not a valid repository name
npm ERR! git clone git@github.com:file:apis/lesson   Email support@github.com for help
npm ERR! 404 404 Not Found: SlotApi
npm ERR! 404 
npm ERR! 404 'SlotApi' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 It was specified as a dependency of 'GetGoAPI'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.

npm ERR! System Linux 3.13.0-52-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
....

Please explain why this would not work since logically I feel as though I should be able to have local dependency.

For anyone else that might stumble upon this, @Tom Robinson's comment answered the question correctly. I just needed to update to npm v 2.0.0.

Which can be done by:

sudo npm install npm -g

file:作为2.0.0版的一部分添加的,因此需要升级npm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM