Peer/Dev Dependency Resolution Error
envgap__lerna__lerna-2822
Original GitHub issue ↗Opened 2021-02-17
01 / FAILURE SIGNATURE
As reported upstream
Upon bootstrapping I encounter the following error:
Not a benchmark task.
- No curated issue-specific recipe or verified environment fix is available.
02 / ENVIRONMENT RECIPE
- Base commit
Not freshly verified- Manifest
package.json- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
lerna/lerna #2822 · read the original issue
<!--- Provide a general summary of the issue in the Title above -->
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`
```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`
```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!
<details><summary>lerna.json</summary><p>
<!-- browsers demand the next line be empty -->
```json
{
"$schema": "https://json.schemastore.org/lerna",
"npmClient": "npm",
"packages": ["packages/*"],
"version": "0.1.0"
}
```
</p></details>
## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
| Executable | Version |
| ---: | :--- |
| `lerna --version` | 3.22.1 |
| `npm --version` | 7.5.2 |
| `node --version` | 14.15.5 |
| OS | Version |
| --- | --- |
| macOS Catalina | 10.15.7 |
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]
Issue-specific recipe and runtime smoke command require review against the complete issue and repository.
Legacy already_works is install-only; proposed control still requires runtime verification.