【发布时间】:2015-04-09 17:25:18
【问题描述】:
如果我依赖一个本身依赖于另一个本地包的本地包,npm install 似乎不起作用。我使用的是 npm 2.5.1 版。
这是我所拥有的:
/src/modules/moduleA 的 package.json:
{
"name": "moduleA",
"version": "0.0.1",
...
"dependencies": {
"bluebird": "^2.9.1",
"nodemailer": "^1.3.0"
}
}
/src/modules/moduleB 的 package.json:
{
"name": "moduleB",
"version": "1.0.0",
...
"dependencies": {
"nconf": "~0.6.7",
"moduleA": "../moduleA"
}
}
/src/apps/coolApp 的 package.json:
{
"name": "coolApp",
"version": "1.0.0",
...
"dependencies": {
"mysql": "~2.4.2",
"request": "~2.40.0",
"cheerio": "~0.17.0",
"async": "~0.9.0",
"expand-url": "0.1.3",
"moduleB": "../../modules/moduleB"
}
}
现在如果我尝试npm install:
cd /src/modules/moduleA
npm install
[success, yay!]
cd /src/modules/moduleB
npm install
[success, yay!]
cd /src/apps/coolApp
npm install
npm ERR! addLocal Could not install /src/node/apps/moduleA
npm ERR! enoent ENOENT, open '/src/node/apps/moduleA'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
[oh no!]
出于某种原因,npm 正在尝试为coolApp 安装moduleA,即使它不需要直接安装,而且它使用相对路径字符串,因为它在moduleB 的package.json 文件中指定,尽管这对coolApp 无效,因为它位于相对不同的位置。
【问题讨论】:
标签: npm