npm install fails for a package added as dependency in another package
See original GitHub issueI have 2 services-serviceA and serviceB. serviceA is added as a dev-dependency in serviceB
package.json of serviceB has
“devDependencies”: { “serverless-bundle”: “^4.0.1”, “serviceA”: “^0.1.0” }
Expected Behavior
npm install should install serverless-bundle and ignore serviceA
Current Behavior
npm install fails with error
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/serviceA - Not found
npm ERR! 404
npm ERR! 404 'serviceA@^0.1.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'serviceA'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
</p></details>
{
"packages": ["lib/*", "services/*"],
"version": "0.0.0.0",
"useWorkspaces": true,
"npmClient": "npm"
}
<details><summary>lerna-debug.log</summary><p>
<!-- browsers demand the next line be empty -->
```txt
<!-- If you have a `lerna-debug.log` available, please paste it here -->
<!-- Otherwise, feel free to delete this <details> block -->
Context
Your Environment
Executable | Version |
---|---|
lerna --version |
VERSION |
npm --version |
VERSION |
yarn --version |
VERSION |
node --version |
VERSION |
OS | Version |
---|---|
NAME | VERSION |
Issue Analytics
- State:
- Created 3 years ago
- Comments:13
Top Results From Across the Web
NPM doesn't install module dependencies - Stack Overflow
I found out that two of the packages needed different versions of the dependency. I resolved the conflict, removed node_modules and after a...
Read more >Dependency or package not found - DeployHQ
Troubleshooting missing package or dependency errors when using the DeployHQ build pipeline.
Read more >npm-ci
Save installed packages to a package.json file as dependencies. When used with the npm rm command, removes the dependency from package.json . Will...
Read more >NPM Dependency errors? Then You're doing it wrong. - Medium
0, then when you run NPM install, it will automatically upgrade it to 1.3.0 since you specify it as ^(caret) in package.json. The...
Read more >Npm install error(fails) - M220JS - MongoDB
... npm install and it started to show errors , tried different methods like changing package.json dependencies to " * " , installing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hi @s1mrankaur can you provide more details? It would be useful to see the
package.json
ofserviceA
.Not involved in this project at all, but as far as I can tell, this is by design. It’s more obvious once you know how lerna actually works, which is surprisingly hard information to find: https://github.com/lerna/lerna/issues/2447#issuecomment-608410145
In my case, I was trying to troubleshoot missing dependencies after an
npx lerna bootstrap
. Once I understood how lerna worked, I was able to mimic it by deleting the same local packages from package.json before runningnpm install
.There’s really no way
npm install
could possibly work without deleting the local packages from package.json first.npm
would somehow have to know to skip the lerna-managed stuff. Maybe if lerna added something to package.json or package-lock.json, but I’m not sure what that would be.