Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm install <local folder> does not run postinstall #4804

Closed
2 tasks done
oshi97 opened this issue Apr 25, 2022 · 9 comments
Closed
2 tasks done

[BUG] npm install <local folder> does not run postinstall #4804

oshi97 opened this issue Apr 25, 2022 · 9 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@oshi97
Copy link

oshi97 commented Apr 25, 2022

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

Installing a local npm package does not run the postinstall script.

Expected Behavior

The postinstall script runs, and in this case creates a new file

Steps To Reproduce

  1. git clone https://github.com/oshi97/install-links.git
  2. git checkout postinstall
  3. cd parent
  4. npm i ../child
  5. expected to see a new test.txt file created, but no file was created

Environment

  • npm: 8.7.0
  • Node.js: 16.14.2
  • OS Name: macOS Monterey
  • System Model Name: 2013 Mac Pro
  • npm config:
; "user" config from /Users/oshi/.npmrc

//registry.npmjs.org/:_authToken = (protected) 

; node bin location = /Users/oshi/.nvm/versions/node/v16.14.2/bin/node
; node version = v16.14.2
; npm local prefix = /Users/oshi/techops/install-links-test/parent
; npm version = 8.7.0
; cwd = /Users/oshi/techops/install-links-test/parent
; HOME = /Users/oshi
; Run `npm config ls -l` to show all defaults.
@oshi97 oshi97 added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Apr 25, 2022
@manigedit
Copy link

@oshi97 I'm unable to reporoduce this issue. In my case test.txt file gets created. Please share more details / anything I'm missing to reproduce this issue.

image

@Niryo
Copy link

Niryo commented Apr 27, 2022

happens to me as well, node 16.15.0, npm 8.5.5. I also tried the steps given here to reproduce and I can confirm the issue.
I am running on macOS Monterey (MacBook Pro 16-inch, 2019)
image

@oshi97
Copy link
Author

oshi97 commented Apr 27, 2022

@oshi97 I'm unable to reporoduce this issue. In my case test.txt file gets created. Please share more details / anything I'm missing to reproduce this issue.

image

It could be your npm version?

@oshi97
Copy link
Author

oshi97 commented Apr 27, 2022

I've noticed that npm install <pkg-name> seems to not run the postinstall for instances where node_modules have not changed. For instance, if I run npm install blah as a new dependency, the postinstall would run, but running npm install blah will not run the postinstall. However if I try to npm install blah@aDifferentVersion the postinstall will run. From an outside perspective I feel like this could be related to npm installing a local folder, since a local folder install will create a symlink instead of copying local files, and may even be intentional behavior.

@bennieswart
Copy link

We're seeing the same issue on node 16.15.0 with npm 8.5.5. It worked previously on node 16.14.2 with npm 8.5.0.

@tleunen
Copy link

tleunen commented May 17, 2022

Same here. postinstall doesn't run on Node 16.15.0 with npm 8.5.5, but it works fine in node 16.14.2 with npm 8.5.0

The setup is with NPM workspaces, where one of the workspace is a dependency of another and it contains a postinstall script.

Updating npm to 8.10.0 seems to fix this issue for me tho

@qq326943819
Copy link

qq326943819 commented Jun 29, 2022

I also encountered a similar problem.
When installing packages like yorkie, the life cycle of install, including install and postinstall, was not triggered.

node: 16.15.0
npm: 8.5.5

When switching to version 14, it works normally.

@oshi97 oshi97 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 9, 2023
@CSchulz
Copy link

CSchulz commented Jan 26, 2023

I have encountered the same issue on Windows 10 Pro with node 16.15.0 and npm 8.5.5.

I thought I have done anything wrong with my package.json until I have searched this behavior as an issue.

@ariym
Copy link

ariym commented Apr 17, 2023

This issue is still present in node v19.9.0 (npm v9.6.3)

I can only get the postinstall script to run by reverting to an earlier version of node.

badeball added a commit to badeball/cypress-cucumber-preprocessor that referenced this issue Sep 20, 2024
For reasons unknown to me, `npm install <path>` will not trigger
postinstall scripts [1].

[1] npm/cli#4804
badeball added a commit to badeball/cypress-cucumber-preprocessor that referenced this issue Sep 22, 2024
For reasons unknown to me, `npm install <path>` will not trigger
postinstall scripts [1].

[1] npm/cli#4804
badeball added a commit to badeball/cypress-cucumber-preprocessor that referenced this issue Sep 22, 2024
For reasons unknown to me, `npm install <path>` will not trigger
postinstall scripts [1].

[1] npm/cli#4804
badeball added a commit to badeball/cypress-cucumber-preprocessor that referenced this issue Sep 24, 2024
For reasons unknown to me, `npm install <path>` will not trigger
postinstall scripts [1].

[1] npm/cli#4804
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

8 participants