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] scripts-prepend-node-path not respected in npm v8.1.2 #4131

Closed
2 tasks done
sajal50 opened this issue Dec 6, 2021 · 1 comment
Closed
2 tasks done

[BUG] scripts-prepend-node-path not respected in npm v8.1.2 #4131

sajal50 opened this issue Dec 6, 2021 · 1 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

Comments

@sajal50
Copy link

sajal50 commented Dec 6, 2021

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

I have a postinstall script in my package.json which does which node.

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "postinstall": "which node"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

With node v16.13.1 and npm v8.1.2, I get the following result -

sajal@C02WM2ARHTDD test % ../node-v16.13.1-darwin-x64/bin/node ../node-v16.13.1-darwin-x64/bin/npm install --scripts-prepend-node-path=true

> [email protected] postinstall
> which node

/usr/local/bin/node

up to date, audited 1 package in 554ms

found 0 vulnerabilities
sajal@C02WM2ARHTDD test % 

node is resolving to my global installation.

Expected Behavior

However, with node v14.8.2 and npm v6.14.15, node resolves to my local installation -

sajal@C02WM2ARHTDD test % ../node-v14.18.2-darwin-x64/bin/node ../node-v14.18.2-darwin-x64/bin/npm install --scripts-prepend-node-path=true

> [email protected] postinstall /Users/sajal/Desktop/sajal_ws/test
> which node

/Users/sajal/Desktop/sajal_ws/node-v14.18.2-darwin-x64/bin/node
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

up to date in 0.376s
found 0 vulnerabilities

sajal@C02WM2ARHTDD test

IIUC, with scripts-prepend-node-path=true, should continue to resolve to my local installation even with node v16.13.1 and npm v8.1.2. If this has been deprecated, please let me know.

Steps To Reproduce

As explained in Current Behavior section.

Environment

  • OS: macOS 10.15.7
  • platform: Macbook Pro
@sajal50 sajal50 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 Dec 6, 2021
@wraithgar
Copy link
Member

#2808

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

2 participants