-
Notifications
You must be signed in to change notification settings - Fork 284
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
process.env.PWD is not set on Windows 10 when using powershell #1881
Comments
Why are you reporting that here? I'm closing this out. Let me know if there is reason to reopen. |
Sorry, I didn't know where else to post this. Also, there are multiple other issues regarding And, btw, aren't some env variables set directly by node and npm? If no - is there a way to consistently set PWD correctly outside of bash? |
@Raiondesu I’ve moved this issue to nodejs/help, that should be a good place for this – it doesn’t appear to be an issue with node itself, though.
Some are used internally by node (e.g. for communicating with child processes), but generally, node doesn’t set generic env vars. npm does so, a lot – mostly to communicate the current npm config with processes – but it’s a completely different piece of software, it just happens to be shipped together with node.
I mean, you an always include |
@addaleax, thank you very much for moving this! PWD and cwd sometimes seem to be different (as stated here):
in bash: user@pc: /home/user/project/src$ npm run script-that-logs-cwd-and-pwd
cwd: /home/user/project/src
PWD: /home/user/project
user@pc: /home/user/project/src$ _ or user@pc: /home/user/project/src$ node
> process.cwd()
/home/user/project/src
> process.env.PWD
/home/user/project In Windows PowerShell, however, this behaviour is broken: PS ...\project\src> npm run script-that-logs-cwd-and-pwd
cwd: ...\project\src
PWD: undefined or PS ...\project\src> node
> process.cwd()
...\project\src
> process.env.PWD
undefined hence, there is no reliable way to determine the project root directory by running the script. It is not obvious, if PWD is related to node or to OS, since there's practically no documentation for it anywhere. |
@Raiondesu As the linked stackoverflow question states, the reason that the two are different is that not every code that changes the current working directory also updates the
You could look up
It’s a bash feature: https://manpage.me/?q=bash (you can search for |
Ok, I guess, I clearly misunderstood this part. Thank you very much for making it clear for me and everyone else who sees this. 😊 |
replace process.env.PWD by process.cwd() in two files, until the project start. Might cause problems as cwd might be different from PWD nodejs/help#1881
[FEATURE] track changes in blur or weight values [FEATURE] local data structure and value for tamarin [Data] Add washing machine dataset [FEATURE] Offline computation - KendallTau Tests [UPDATE] package-lock on windows by npm [Fix] Remove sassMiddleware, update pkg [FIX] fixing duplication of handles on update [FIX] Get criteria to take into account the sorting order in the group clause (#29) [FIX] PWD in windows Offline computation of the impact of the granularity and importance factor using kendall tau test. Test Granularity, Importance, Shape replace process.env.PWD by process.cwd() in two files, until the project start. Might cause problems as cwd might be different from PWD nodejs/help#1881 fix the file criteria_get_all.sql, i added the column to the group clause, it should always be the same value. When the criterion is updated from an event ( for ex. when onLoadState ) check if an handle exist before creating a new one
v8.12.0
17134.706
Description
process.env.PWD
logsundefined
on Windows 10 PC using batch/powershell. Issue does not seem to be present when using bash on windows (either GitBash or using an Ubuntu subsystem).Reproduction
Just do
( yields
undefined
)on a Windows 10 PC.
If cannot reproduce - proceed to
npm i https://github.com/ke-mantha/mantha.git#test
in an empty directory.The text was updated successfully, but these errors were encountered: