npm / npm/cli

[BUG] `npm audit fix --force` trying to update package to `undefined`

Open
#4,377 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage 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
npm audit fix --force
npm WARN using --force Recommended protections disabled.
npm WARN audit Updating @docusaurus/core to undefined,which is a SemVer major change.
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @docusaurus/core@undefined.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/charliefish/.npm/_logs/2022-02-05T18_43_57_293Z-debug.log
Expected Behavior

No errors to occur when running npm audit fix --force.

Steps To Reproduce
  1. With the package.json file listed below & no package-lock.json file
  2. Run npm i
  3. Then npm audit fix --force

package.json:

{
  "name": "docs",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "docusaurus start",
    "build": "npm run prebuild && docusaurus build",
    "swizzle": "docusaurus swizzle",
    "prebuild": "cd .. && npm run build && cd docs && node process.js"
  },
  "dependencies": {
    "@docusaurus/core": "^2.0.0-beta.15",
    "@docusaurus/preset-classic": "^2.0.0-beta.15",
    "classnames": "^2.3.1",
    "jsdoc-to-markdown": "^7.1.1",
    "mkdirp": "^1.0.4",
    "npm-to-yarn": "^1.0.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "simple-git": "^3.1.1"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
Environment
  • npm: 8.1.2
  • Node.js: v16.13.2
  • OS Name: macOS
  • System Model Name: Macbook Pro
  • npm config:
; "user" config from /Users/charliefish/.npmrc

//npm.pkg.github.com/:_authToken = (protected)
//registry.npmjs.com/:_authToken = (protected)
registry = "https://npm.network.charlie.fish/"

; node bin location = /Users/charliefish/.nvm/versions/node/v16.13.2/bin/node
; cwd = /Users/charliefish/Developer/dynamoose/dynamoose/docs
; HOME = /Users/charliefish
; Run `npm config ls -l` to show all defaults.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report using the provided package.json, npm i, and npm audit fix --force without a package-lock.json. Trace npm audit fix's handling of the missing target version; done means it no longer requests @docusaurus/core@undefined or fails with ETARGET.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.