Skip to content

[BUG] --ignore-scripts is not respected by npm publish #3707

Closed

Description

@juanrgm

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

npm ERR! code 1
npm ERR! path /pkg
npm ERR! command failed
npm ERR! command sh -c echo Failed && exit 1
npm ERR! Failed

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-09-01T18_00_57_472Z-debug.log

Expected Behavior

npm notice 
npm notice package: [email protected]
npm notice === Tarball Contents ===
npm notice 115B package.json
npm notice === Tarball Details ===
npm notice name:          test
npm notice version:       0.0.1
npm notice filename:      test-0.0.1.tgz
npm notice package size:  180 B
npm notice unpacked size: 115 B
npm notice shasum:        709f297e88cc2041bf93d30742bc4fbdcb63690f
npm notice integrity:     sha512-/eb5abNq1YYmO[...]hDW8R2gOKj1TA==
npm notice total files:   1
npm notice
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in.
npm ERR! need auth You need to authorize this machine using `npm adduser`

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-09-01T18_02_05_247Z-debug.log

Steps To Reproduce

{
    "name": "test",
    "version": "0.0.1",
    "scripts": {
        "prepare": "echo Failed && exit 1"
    }
}
npm publish --ignore-scripts

Environment

  • OS: Windows 10 / Alpine 3.13
  • Node: 16.8.0
  • npm: 7.21.0

Activity

  1. added
    Bug
    Needs Triage
    Release 7.x
    on Sep 1, 2021
  2. added
    Enhancement
    and removed
    Bug
    Needs Triage
    on Sep 24, 2021
  3. kombuchamp commented on Feb 11, 2022

    @kombuchamp

    Checked on npm version 8.3.1 (node v16.14.0) - npm publish --ignore-scripts still gets "prepare" script triggered. Is this intended behaviour?
    I see another issue where this problem was fixed
    #2755
    in this pr:
    https://github.com/npm/cli/pull/3495/files

    And this code is still in publish.js, which means that it it is probably a bug
    https://github.com/npm/cli/blob/latest/lib/commands/publish.js#L120
    Tests on publish.js related to this behaviour are still passing, which might mean that there could be an issue with setting config parameter "ignore-scripts" through cli

  4. dominykas commented on Nov 14, 2022

    @dominykas

    It seems the issue is still there - regardless of how ignore-scripts is set (env, config, etc), the prepare script gets executed during npm publish and npm pack.

    I'll see if I can get a minimal test case going...

  5. dominykas commented on Nov 14, 2022

    @dominykas

    Oh, seems it was only meant to be fixed in v9: #5651

  6. added
    semver:major
    and removed
    Release 7.x
    on May 11, 2024
  7. lukekarrys commented on May 14, 2024

    @lukekarrys
    Contributor

    Closing this since it will be tracked as a breaking change in our v11 roadmap instead of as a bugfix. npm/statusboard#488

  8. aretel commented on Nov 14, 2024

    @aretel

    Is there any way to bypass this bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancementsemver:major

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions