[BUG] Cannot convert undefined or null to object on unpublished package
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
When doing npm install and there is a package installed from github that has the same name as an unpublished package in npm, the error "Cannot convert undefined or null to object" appears. See https://github.com/npm/metavuln-calculator/pull/7#issuecomment-989099759 and https://github.com/npm/metavuln-calculator/issues/12
The security audit causes a crash in npm. We cannot easily rename internally managed packages simply to avoid colliding with an unpublished npm package.
Expected Behavior
I expected the install to succeed (as it did in npm version 6).
Steps To Reproduce
- Create a package.json that references a github repository with the same name as an unpublished package. e.g.
"dependencies": {
"mwater-forms": "github:mWater/mwater-forms"
},
- With latest npm
- Run npm install
- See error: "Cannot convert undefined or null to object"
Environment
- npm: 8.3.2
- Node.js: v16.13.2
- OS Name: Mint 20.3
- System Model Name: Dell?
- npm config:
; "user" config from /home/clayton/.npmrc
//registry.npmjs.org/:_authToken = (protected)
; node bin location = /home/clayton/.nvm/versions/node/v16.13.2/bin/node
; cwd = /home/clayton/dev/scratch/failnpm
; HOME = /home/clayton
; 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
Reproduce the failure with the package.json dependency shown and npm 8.3.2, then trace the security-audit path implicated by the report. Review the linked metavuln-calculator pull request and issue for context; done means npm install succeeds when a GitHub package collides with an unpublished npm package.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100