我在我的应用程序的根目录中有以下package.json。
....
"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"
},
.....
我在/ apis / lesson有一个自定义模块。但是,只要我在应用程序的根目录下执行npm install,它就会失败并给我这个错误。
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"
....
请解释为什么这不起作用,因为逻辑上我觉得我应该能够有本地依赖。
答案 0 :(得分:0)
对于其他可能偶然发现的人,@ Tom Robinson的评论正确地回答了这个问题。我只需要更新到npm v 2.0.0。
可以通过以下方式完成:
sudo npm install npm -g
答案 1 :(得分:0)
file:
已作为版本2.0.0
的一部分添加,因此需要升级npm
。