Skip to content

Git dependency prepare script running with --package-lock-only #3300

Closed

Description

@feelepxyz

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

👋 I've just run into this in dependabot when trying to update discord.js. The following command fails: npm install discord.js@github:discordjs/discord.js#b376f31af9881b9cd3f82ac4a42a468947cce482 --ignore-scripts --package-lock-only with:

npm ERR! code 127
npm ERR! path /Users/feelepxyz/.npm/_cacache/tmp/git-clone-e8ed8817
npm ERR! command failed
npm ERR! command sh -c husky install
npm ERR! sh: husky: command not found

It looks like this prepare script is running with the above install. It passes without --package-lock-only.

There is a similar issue about the projects lifecycle hooks but this seems subtly different as it's about git dependencies: #2787

Expected Behavior

The command npm install discord.js@github:discordjs/discord.js#b376f31af9881b9cd3f82ac4a42a468947cce482 --ignore-scripts --package-lock-only should successfully install.

Steps To Reproduce

  1. npm install -g [email protected]
  2. npm install discord.js@github:discordjs/discord.js#b376f31af9881b9cd3f82ac4a42a468947cce482 --ignore-scripts --package-lock-only

Environment

  • OS: Mac OS Catalina 10.15.7
  • Node: v15.6.0
  • npm: 7.14

Activity

  1. added
    Bug
    Needs Triage
    Release 7.x
    on May 24, 2021
  2. feelepxyz commented on May 25, 2021

    @feelepxyz
    ContributorAuthor

    The same bug is reported here: #2920 but would be helpful if it's possible to disable running prepare scripts if --package-lock-only or --ignore-scripts are set. Either would work for dependabot's use case where we care about disabling all life-cycle hooks.

  3. isaacs commented on Jun 18, 2021

    @isaacs
    Contributor

    #2920 is a slightly different bug.

    I could see disabling prepares when --ignore-scripts is set, but we do need to run them for the package-lock-only, or else we can't be guaranteed to get the correct results in the package-lock.json file.

    Will be fixed when npm/pacote#81 lands.

  4. wraithgar commented on Jun 30, 2021

    @wraithgar
    Contributor

    #1422 may also be related

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

    BugNeeds TriageRelease 7.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions