Reputation: 357
npm install doesn't seem to work if I depend on a local package that itself depends on another local package. I'm using npm version 2.5.1.
Here's what I have:
package.json for /src/modules/moduleA:
{
"name": "moduleA",
"version": "0.0.1",
...
"dependencies": {
"bluebird": "^2.9.1",
"nodemailer": "^1.3.0"
}
}
package.json for /src/modules/moduleB:
{
"name": "moduleB",
"version": "1.0.0",
...
"dependencies": {
"nconf": "~0.6.7",
"moduleA": "../moduleA"
}
}
package.json for /src/apps/coolApp:
{
"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"
}
}
Now if I try to 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!]
For some reason, npm is trying to install moduleA for coolApp, even though it doesn't need to directly, and also, it is using the relative path string as it is literally specified in the package.json file for moduleB, even though that isn't valid for coolApp since it is in a relatively different location.
Upvotes: 3
Views: 181
Reputation: 357
I found that if you specify the local modules with "file:" before the path, everything works fine. Yay
Like this:
"moduleB": "file:../../modules/moduleB"
Upvotes: 3