-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
- I am using the latest npm
Current Behavior
Running npm install --omit=dev in a workspace monorepo with install-strategy=linked crashes:
npm warn reify The "linked" install strategy is EXPERIMENTAL and may contain bugs.
npm error Cannot read properties of undefined (reading 'isProjectRoot')
Without --omit=dev, install works fine.
Expected Behavior
Should install only production dependencies without crashing.
Steps To Reproduce
mkdir -p /tmp/repro/packages/my-lib && cd /tmp/repro
cat > package.json << 'EOF'
{
"name": "my-monorepo",
"private": true,
"workspaces": ["packages/*"],
"dependencies": {
"abbrev": "^2.0.0"
},
"devDependencies": {
"semver": "^7.6.0"
}
}
EOF
cat > packages/my-lib/package.json << 'EOF'
{
"name": "my-lib",
"version": "1.0.0",
"dependencies": {
"abbrev": "^2.0.0"
},
"devDependencies": {
"lru-cache": "^10.0.0"
}
}
EOF
echo "install-strategy=linked" > .npmrc
npm install --omit=dev # crashes
npm install # works fineRoot Cause
addOmitsToTrashList in reify.js iterates idealTree.inventory and reads node.top.isProjectRoot. With linked strategy, createIsolatedTree() in isolated-reifier.js builds proxy node objects — but the workspace and workspace link proxies are missing the top property entirely, so accessing top.isProjectRoot throws.
Note: this is v10-only. npm 11 removed addOmitsToTrashList and moved omit handling into the diff calculation.
Environment
- npm: 10.9.5
- Node.js: 22.20.0
- OS Name: macOS (Darwin 25.3.0)
- npm config:
install-strategy=linked
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels