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 <folder> runs prepare #8121

Open
2 tasks done
winstliu opened this issue Feb 19, 2025 · 1 comment
Open
2 tasks done

[BUG] npm install <folder> runs prepare #8121

winstliu opened this issue Feb 19, 2025 · 1 comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@winstliu
Copy link

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

Running npm install ../../some/other/path/globals will attempt to run globals' prepare script.

Expected Behavior

I would expect the script not to run, as the documentation for prepare says "Runs on local npm install without any arguments". This is not a local npm install witout any arguments - I view it the same as npm install globals, which does not run prepare.

Steps To Reproduce

  1. Install the globals package somewhere
  2. In a completely different folder, run npm install ../path/to/globals to try to symlink it
  3. :(

Environment

  • npm: 11.1.0
  • Node.js: 22.14.0
  • OS Name: Windows 11 24H2
  • System Model Name: Surface
  • npm config:
; This is the only non-commented, non-authentication line
prefix = "C:\\Users\\winstonliu\\AppData\\Roaming\\npm"
@winstliu winstliu added Bug thing that needs fixing Needs Triage needs review for next steps labels Feb 19, 2025
@milaninfy
Copy link
Contributor

milaninfy commented Feb 21, 2025

@winstliu I believe it's a special case of prepare script for linked dependencies.

https://docs.npmjs.com/cli/v11/using-npm/scripts

prepare is only run if the current directory is a symlink (e.g. with linked packages)

you can use ignore-scripts or install-links flags to control the way it's installed.

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
Projects
None yet
Development

No branches or pull requests

2 participants