[BUG] `npm install` silently fails to create symlinks for workspaces when "`main`" is added in parent `package.json`
Open
Nobody has claimed this yet.
Bug
Release 8.x
- 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
When I am trying to bootstrap a project with workspaces and main is present the installation fails to symlink the workspaces.
Expected Behavior
Symlinking the workspaces or showing a warning message.
Steps To Reproduce
- Create a project with
npm init -y,mainshould be present inside the parentpackage.json - Add one or more workspaces
- Run
npm install - Workspaces are not properly symlinked, no error or warning is thrown.
Example structure:
+-- package.json
`-- workspace-a
`-- package.json
Example parent package.json :
{
"name": "my-workspaces-powered-project",
"main": "index.js",
"workspaces": [
"workspace-a"
],
"devDependencies": {
"typescript": "4.3.5",
"@types/node": "16.7.5",
}
}
Environment
- npm: 8.0.0
- Node: v16.11.1
- OS: MacOS
- npm config:
; "builtin" config from /opt/homebrew/lib/node_modules/npm/npmrc
prefix = "/opt/homebrew"
; node bin location = /opt/homebrew/Cellar/node/16.11.1/bin/node
; cwd = /Users/vorillaz
; HOME = /Users/vorillaz
; Run `npm config ls -l` to show all defaults.
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
Start by reproducing the workspace layout and parent package.json shown in the issue, then run npm install with the reported npm and Node versions. Trace the workspace installation path to determine why the symlink is skipped when main is present; done means the workspace is symlinked or npm emits a warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100