Skip to content

[BUG] Cannot convert undefined or null to object on unpublished package #4313

@grassick

Description

@grassick

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 npm/metavuln-calculator#7 (comment) and npm/metavuln-calculator#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

  1. 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"
  },

  1. With latest npm
  2. Run npm install
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issueRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions