npm / npm/cli

[BUG] Installing with --prefer-offline does not work if dependencies are not available in the cache

Open
#6,367 10 comments 31 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 9.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 i --prefer-offline
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @vaadin/scroller@24.1.0-alpha8.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
Expected Behavior

It should fetch the missing version from npmjs.com, like npm i does. That is the whole point of using --prefer-offline offline instead of --offline

Steps To Reproduce

Using

{
  "name": "no-name",
  "license": "UNLICENSED",
  "type": "module",
  "dependencies": {
    "@vaadin/scroller": "24.1.0-alpha8"
  }
}

run npm i --prefer-offline

Environment
  • npm: 9.5.1
  • Node.js: v18.16.0
  • OS Name: macOs Ventura
  • System Model Name: Mac M1
  • npm config:
ignore-scripts = true 

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

Start with the package.json dependency on @vaadin/scroller@24.1.0-alpha8 and reproduce the issue using npm i --prefer-offline; compare it with npm i and --offline. Done means a missing dependency is fetched from npmjs.com under --prefer-offline instead of producing ETARGET.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.