Skip to content

[BUG] npm install does not run prepare script for local file dependencies #459

Closed

Description

@HosseinAgha

What / Why

Imagine I have package-a that depends on the package-b using the file specifier.
For example we have this dependency line in the package.json of package-a:

"name": "package-a",
"dependencies": {
   "package-b": "file:../package-b"
}

How

Current Behavior

If I run npm install in package-a then npm correctly installs package-b dependencies.
But it only runs preinstall and postinstall scripts and ignores prepare script.
If I run npm install directly in package-b then it successfully runs the prepare script.

Expected Behavior

It should run prepare script for local dependencies (package-b) like it would for github dependencies. This gets very confusing for npm users as npm install would run inconsistent scripts for different dependency types.

References

I think #321 is related but it seems fixed in the latest version.

npm version

I use node v12.13.0 and npm 6.13.0

Activity

  1. qrosmeli commented on Nov 26, 2019

    @qrosmeli

    The same thing is happening to me. I also tried to install package-b in another project (npm install "../folder/package-a/package-b") and I got the same result: package is installed, but no prepare or prepublish script ran. Is this an expected behavior?

    I have node v10.16.0 and npm v6.9.0.

  2. shrinktofit commented on Dec 23, 2020

    @shrinktofit

    Any updates?

  3. darcyclarke commented on Jun 2, 2021

    @darcyclarke
    Contributor

    npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

    If your bug is preproducible on v7, please re-file this issue using our new issue template.

    If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

    Closing: This is an automated message.

  4. darcyclarke commented on Jun 2, 2021

    @darcyclarke
    Contributor

    npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

    If your bug is preproducible on v7, please re-file this issue using our new issue template.

    If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

    Closing: This is an automated message.

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

    Bugthing that needs fixing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions