[BUG] `npm link` does not work correctly with workspaces and `install-strategy=nested`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
I have two projects
Puppeteer uses this .npmrc
install-strategy=nested. packages/puppeteer-core has the chromium-bidi as a dependency.
The linked package get linked at the top level rather then on the package-level.
That mean the downloaded version is always resolved by Node.
Expected Behavior
The linked packages is placed in the correct place packages/puppeteer-core/ and runs the locally linked version.
Steps To Reproduce
- Download
puppeteerandchromium-bidi - Install dependecies in both
- Run
npm run buildin both (will build anything necessary, also prevent's an issue related to linking andpeerDependencieswhere there are type errors) - Run
npm linkinchromium-bidi - Run
npm link chromium-bidiornpm link chromium-bidi -w puppeteer-coreinpuppeteer - Observe that the
packages/puppeteer-core/node_modules/chromium-bidiis the downloaded version and not the symlink one. - Observe that
node_module/chromium-bidiis a symlink tochromium-bidi
Environment
- npm: 10.5.0
- Node.js: 20.10.0
- OS Name: Linux
- System Model Name: -
- npm config:
; "project" config from /usr/local/google/home/nvitkov/puppeteer/.npmrc
access = "public"
install-strategy = "nested"
; node bin location = ~/.nvm/versions/node/v20.10.0/bin/node
; node version = v20.10.0
; npm local prefix = ~/puppeteer
; npm version = 10.5.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using Puppeteer's .npmrc with install-strategy=nested and the linked chromium-bidi and puppeteer-core workspace. Start by running the listed build and npm link commands, then inspect packages/puppeteer-core/node_modules/chromium-bidi and the top-level node_modules entry. Done means the workspace package contains the symlink and resolves the locally linked version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100