首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在package.json依赖项列表中安装本地模块。由文件路径定义

无法在package.json依赖项列表中安装本地模块。由文件路径定义
EN

Stack Overflow用户
提问于 2015-07-09 15:27:16
回答 2查看 409关注 0票数 0

我在我的应用程序的根目录中有以下package.json。

代码语言:javascript
复制
....
"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,它就会失败,并给出这个错误。

代码语言:javascript
复制
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"
....

请解释为什么这不起作用,因为从逻辑上讲,我觉得我应该能够有本地依赖。

EN

回答 2

Stack Overflow用户

发布于 2015-07-09 16:15:19

对于其他可能偶然发现这一点的人,@Tom Robinson的评论正确地回答了这个问题。我只需要更新到npm v2.0.0。

这可以通过以下方式完成:

代码语言:javascript
复制
sudo npm install npm -g
票数 0
EN

Stack Overflow用户

发布于 2015-07-09 16:15:49

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31310791

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档