npm / npm/cli

[BUG] npm update of a single global package requires allow-scripts for all installed packages

Open
#9,797 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

allowScripts Bug Needs Triage Priority 2
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
This is not just a request to bump a dependency for a CVE
  • This is not solely a request to bump a dependency for a CVE
Current Behavior

during npm update for a single global package, it show warning for other global package that are not targeted for update.

Expected Behavior

since npm update is for a single global package, it should not show warning for other packages.

Steps To Reproduce
mkdir -p /tmp/npm-global/lib
export NPM_CONFIG_PREFIX=/tmp/npm-global
npm install -g --allow-scripts=opencode-ai opencode-ai
npm install -g --allow-scripts=yarn yarn
npm update -g --allow-scripts=opencode-ai opencode-ai
rm -rf /tmp/npm-global
unset NPM_CONFIG_PREFIX

during npm update ... command, the following warning is shown:

npm warn install-scripts 1 package had install scripts blocked because they are not covered by allowScripts:
npm warn install-scripts   yarn@1.22.22 (preinstall: :; (node ./preinstall.js > /dev/null 2>&1 || true))
npm warn install-scripts
npm warn install-scripts Run `npm install -g --allow-scripts=yarn` to allow these scripts once, or `npm config set allow-scripts=yarn --location=user` to allow them for all global installs.
Environment
  • npm: 12.0.1
  • Node.js: v24.18.0
  • OS Name: Ubuntu 26.04 LTS
  • System Model Name: ThinkPad (intel core i7)
  • npm config:
; "user" config from /home/ubuntu/.npmrc

prefix = "/home/ubuntu/.npm-global"

; environment-related config

; NO_PROXY = "localhost,127.0.0.1,10.0.0.0/24"
; HTTPS_PROXY = "http://10.0.0.8:7128"
; HTTP_PROXY = "http://10.0.0.8:7128"

; node bin location = /usr/bin/node
; node version = v24.18.0
; npm local prefix = /home/ubuntu
; npm version = 12.0.1
; cwd = /home/ubuntu
; HOME = /home/ubuntu
; 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

Start by reproducing the commands in the issue with npm 12.0.1 and Node.js v24.18.0. Trace how a single global-package update evaluates allow-scripts for other installed packages. Done means updating one global package no longer warns about blocked install scripts for unrelated packages, while the reported reproduction remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.