[BUG] Error on npm install with workspaces: "Cannot set properties of null (setting 'dev')"
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
Current Behavior
In an npm workspaces project we have a usecase of nested package - in the directory of package "a" we have a directory containing another package "a-inner".
A different package "b" depends on "a-inner"
trying to npm install only package "b": npm install --workspace @npmwsbug/b
results in an error
log lines from npm log:
58 verbose stack TypeError: Cannot set properties of null (setting 'dev')
58 verbose stack at calcDepFlagsStep (/home/alex/.npm-packages/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:34:21)
58 verbose stack at visit (/home/alex/.npm-packages/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:12:20)
58 verbose stack at visitNode (/home/alex/.npm-packages/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:57:25)
58 verbose stack at next (/home/alex/.npm-packages/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:44:19)
58 verbose stack at depth (/home/alex/.npm-packages/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:82:10)
58 verbose stack at depth (/home/alex/.npm-packages/lib/node_modules/npm/node_modules/treeverse/lib/depth.js:27:12)
58 verbose stack at calcDepFlags (/home/alex/.npm-packages/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:10:15)
58 verbose stack at Arborist.[copyIdealToActual] (/home/alex/.npm-packages/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1400:7)
58 verbose stack at Arborist.reify (/home/alex/.npm-packages/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:153:35)
58 verbose stack at async Install.install (/home/alex/.npm-packages/lib/node_modules/npm/lib/install.js:170:5)
Expected Behavior
workspace should be installed successfully
Steps To Reproduce
clone following example repo - https://github.com/alexpusch/npm-ws-bug-example
run npm install --workspace @npmwsbug/b
error will appear:
TypeError: Cannot set properties of null (setting 'dev')
Environment
- OS: Ubuntu 20
- Node: 16.9.1
- npm: 8.1.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 failure from npm-ws-bug-example with npm install --workspace @npmwsbug/b, then start at @npmcli/arborist/lib/calc-dep-flags.js:34 and follow the reify entry point shown in the stack trace. Done means the workspace installs successfully without the null-property TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100