question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Peer/Dev Dependency Resolution Error

See original GitHub issue

I have two packages in my monorepo, one of which dev-depends and peer-depends on the other. For this example, I’ve swapped out the real names with a and b.

a/package.json

{
  "name": "a",
  "version": "0.1.0",
  "main": "dist/cjs/index.js",
  "types": "dist/cjs/index.d.ts",
  "license": "Apache-2.0"
}

b/package.json

{
  "name": "b",
  "version": "0.1.0",
  "main": "dist/cjs/index.js",
  "types": "dist/cjs/index.d.ts",
  "license": "Apache-2.0",
  "devDependencies": {
    "a": "^0.1.0"
  },
  "peerDependencies": {
    "a": "^0.1.0"
  }
}

Upon bootstrapping I encounter the following error:

lerna ERR! npm install exited 1 in 'b'
lerna ERR! npm install stderr:
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: a@undefined
npm WARN node_modules/a
npm WARN   peer a@"^0.1.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer a@"^0.1.0" from the root project
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/a - Not found
npm ERR! 404 
npm ERR! 404  'a@^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 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

It appears that––for some reason––the version of a is undefined, hence the package is not resolved. Because the package does not exist on NPM, the installation fails altogether.

Any help / advice would be greatly appreciated! Thank you!

lerna.json

{
  "$schema": "https://json.schemastore.org/lerna",
  "npmClient": "npm",
  "packages": ["packages/*"],
  "version": "0.1.0"
}

Your Environment

Executable Version
lerna --version 3.22.1
npm --version 7.5.2
node --version 14.15.5
OS Version
macOS Catalina 10.15.7

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:12

github_iconTop GitHub Comments

1reaction
iamtomcatcommented, Nov 19, 2021

If you’re using npm 7+ now, you just have to add "useWorkspaces": true to your lerna.json as npm has similar behaviour to yarn now.

1reaction
RonWangcommented, May 7, 2021

npm install --legacy-peer-deps lets my install pass without error. Environment: npm v7 on Windows.

Read more comments on GitHub >

github_iconTop Results From Across the Web

you must install peer dependencies yourself Code Example
npm WARN codelyzer@6.0.1 requires a peer of tslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
Read more >
rushstack/rushstack - Gitter
ERROR: Internal Error: Could not find peer dependency '@babel/core' that satisfies version '*' You have encountered a software defect.
Read more >
If a node module includes its own package-lock.json, is that ...
I have a repository that has a bunch of peer dev dependencies (this repo is a standalone eslint config, like airbnb).
Read more >
Core Package Changelog - Twilio Paste
[Code Block] add missing peer/dev dependencies ... [Animation Library] Updates React Spring dependencies to resolve bug with RequestAnimationFrame calls.
Read more >
The npm Blog on Tumblr
Included are several bug fixes that our wonderful users reported to us, ... text for ERESOLVE errors, because "unable to resolve dependency tree"...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found