npm / npm/cli

[BUG] binary not exposed with npm updating missing package globally

Open
#8,896 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage
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

The documentation for npm update states that it would install missing packages.
When I update package X in global scope, the process returns with exit code 0 and

; npm update --global X

changed 1 package in 635ms

To me this would indicate all necessary steps have been taken in order to run the latest version of the package.
However, The binary that is available when running npm install --global X, however, is not known to my shell.

For this to happen I have to run npm install --global X once. Is that intended behaviour?

Expected Behavior

If the user has to install a package in global scope in order to have access to the binary the package exposes, then I would expect the update command to tell me that the package was missing and therefore the command line script to not have been installed.

Steps To Reproduce
  1. with node 24.10.0 and npm 11.7.0
  2. with a package X that exposes a command line script Y in .bin
  3. Run npm uninstall --global X
  4. Run npm update --global X
  5. attempt to call cli script Y
  6. the command is not found
  7. Run npm install --global X
  8. call Y
Environment
  • npm: 11.7.0
  • Node.js: 24.10.0
  • OS Name: OSX 15.7.2
  • System Model Name:
  • npm config:
; node bin location = /Users/XXX/.asdf/installs/nodejs/24.10.0/bin/node
; node version = v24.10.0
; npm local prefix = /Users/XXX
; npm version = 11.7.0
; cwd = /Users/XXX
; HOME = /Users/XXX

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 by reproducing the global workflow with npm 11.7.0: uninstall package X, run npm update --global X, and compare the result with npm install --global X. Trace the global update and .bin handling, then verify that the exposed script Y is available after the intended command and that missing packages are reported consistently.

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.