-
Notifications
You must be signed in to change notification settings - Fork 4.8k
[BUG] INIT_CWD missing in v7 #2033
Copy link
Copy link
Closed
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 7.xwork is associated with a specific npm 7 releasework is associated with a specific npm 7 release
Description
Activity
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 7.xwork is associated with a specific npm 7 releasework is associated with a specific npm 7 release
Did a search on
INIT_CWD, nothing relevant showed up. I also searched through the changelog and didn't find anything relevant.Current Behavior:
In order to get the directory the user was in when the command was run, one can use
process.env.INIT_CWD, as documented here.This was introduced in v5.4.0 according to the changelog.
However, when upgrading from node 14 to node 15,
INIT_CWDis not defined anymore. The upgrade hit me today, as I ranbrew upgradeon my machine. I could reproduce on our Github CI.Expected Behavior:
I did not expect
INIT_CWDto disappear, or if it does, I expect a way to access similar information.Steps To Reproduce:
I created a simple repository to see the regression: https://github.com/Geod24/npm-init-cwd-regression
The repository essentially consist of a
package.jsonthat doesnpm start, andindex.jsis as follow:I setup a Github action to test on Ubuntu with Node 10, 12, 14, and 15.
One can see, when looking at the environment, that the one in 15 is quite different.
Environment:
Can reproduce on Mac and Ubuntu, and other details are linked above.