Skip to content

[BUG] --ignore-scripts is ignored, npm install runs build. #4202

Closed
@trusktr

Description

@trusktr

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 surge -D --ignore-scripts runs scripts:

lume+lume git:develop ❯ npm i surge -D --ignore-scripts                                                                                                                                                                          ✹ ✭
npm ERR! code 2
npm ERR! path /home/trusktr/src/lume+lume/packages/element-behaviors
npm ERR! command failed
npm ERR! command sh -c npm run build
npm ERR! > [email protected] build
npm ERR! > lume build
.
.
.

Expected Behavior

It should not run scripts. In the above output, you see the build script of a package failed.

Steps To Reproduce

  • Provide a reproduction

Environment

  • npm: 8.3.0
  • Node: 17.3.0
  • OS: Pop_os! Linux
  • platform: System 76 Oryx Pro (I'm lovin' it!)
  • npm config:
❯ npm config ls
; "builtin" config from /home/trusktr/.npm-packages/lib/node_modules/npm/npmrc

globalignorefile = "/etc/npmignore" 
; prefix = "/usr/local" ; overridden by user

; "user" config from /home/trusktr/.npmrc

//registry.npmjs.org/:_authToken = (protected) 
prefix = "/home/trusktr/.npm-packages" 

; "project" config from /home/trusktr/src/lume+lume/.npmrc

engine-strict = true 
legacy-peer-deps = true 
package-lock = false 

; node bin location = /home/trusktr/.n-node-versions/bin/node
; cwd = /home/trusktr/src/lume+lume
; HOME = /home/trusktr
; Run `npm config ls -l` to show all defaults.

Reproduction

This can be reproduced with this repo:

https://github.com/lume/lume

Just

  • clone it,
  • npm run fresh to bootstrap the repo (in a Unix OS)
  • then try npm install any-package-you-want -D --ignore-scripts and you'll see it runs npm scripts.

If you delete the prepare script from package.json, the problem does not go away. npm is trying to run scripts from a dependency that's already installed, it seems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 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