Skip to content

[BUG] npmrc ingore-scripts=true blocks rebuild postinstall script #8970

@nicosoenksen

Description

@nicosoenksen

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

With ignore-scripts=true in my .npmrc file, lifecycle scripts will not be executed while running npm install. Perfect.
But they will not be executed with npm rebuild as well.

Expected Behavior

ignore-scripts=true in the .npmrc file only blocks lifecycle scripts while running npm install, not also for npm rebuild, so i can make sure, for which packages the lifecycle scripts will be executed.

Steps To Reproduce

  1. In this environment: local.
  2. add to your .npmrc file ignore-scripts=true
  3. Try to install a package with a lifecycle script. I used the package cypress version 15.7.1, witch has a postinstall script
  4. Try to start cypress, it should throw an error like: "No version of Cypress is installed in: C:\Users***", of course it throws this error, because the post install script wasn`t executed. So it works as expected.
  5. Now run npm rebuild cypress 15.7.1, no error. But if you try to start cypress you will get the same error as before.
    The npm_cache log files for this operation will look like this:
    0 verbose cli C:\Program Files\nodejs\node.exe C:\Users\***\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js 1 info using npm@11.9.0 2 info using node@v25.6.0 3 silly config load:file:C:\Users\**\AppData\Roaming\npm\node_modules\npm\npmrc 4 silly config load:file:C:\Users\*** 5 silly config load:file:C:\Users\***\.npmrc 6 silly config load:file:C:\Users\***\AppData\Roaming\npm\etc\npmrc 7 verbose title npm rebuild cypress 15.7.1 8 verbose argv "rebuild" "cypress" "15.7.1" 9 verbose logfile logs-max:10 dir:C:\Users\***\AppData\Local\npm-cache\_logs\2026-02-09T21_17_34_667Z- 10 verbose logfile C:\Users\***\AppData\Local\npm-cache\_logs\2026-02-09T21_17_34_667Z-debug-0.log 11 silly logfile start cleaning logs, removing 1 files 12 silly packumentCache heap:4496293888 maxSize:1124073472 maxEntrySize:562036736 13 silly logfile done cleaning log files 14 verbose cwd C:\Users\*** 15 verbose os Windows 16 verbose node v25.6.0 17 verbose npm v11.9.0 18 verbose exit 0 19 info ok
    there is no postinstall.

6.remove ignore-scripts=true from your .npmrc and run npm rebuild cypress 15.7.1 again. Cypress will work because the postinstall scripts got executed, you can verify this in the new log:
... 13 silly logfile done cleaning log files 14 info run cypress@15.7.1 postinstall node_modules/cypress node dist/index.js --exec install 15 info run cypress@15.7.1 postinstall { code: 0, signal: null } ... (i just added the new lines here)

Environment

  • npm: 11.8.0 and 11.9.0
  • Node.js: 25.6.0
  • OS Name: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions