-
Notifications
You must be signed in to change notification settings - Fork 30k
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
On Windows, Node can be inconsistent in what case builtin functions use for drive letters #6624
Comments
#3594 might be part of this issue. |
Node changed behavior a few times in the past. From what I can reacall, what was finally deemed the 'proper' way was to never have Node normalize the drive case. So it could change based on the process current directory, as you noted, but at least it would be consistent everywhere internally. Are you seeing any place where Node is changing the case and making it different than process.cwd or what was passed in the command line? If so it should be considered a bug, IMO.
I think it shouldn't. See nodejs/node-v0.x-archive#6774. I'll add it to my todo list to revive that. |
Yes.
|
YES Even when using only relative paths to modules In our case, from looking at the When this occurs, it can load some modules twice which we just experienced when cwd() is initially set with an uppercase *** Edited *** node: v4.4.4 /cc @mousetraps #3594 |
This exemplifies the issue very well, thank you! We could attempt to normalize the casing of __dirname and __filename to match that of process.cwd(). That might have other unwanted side effects though. The real answer is to always make case insensitive path comparisons on Windows. This is on my queue of fixes. |
This is causing issues in webpack. Waiting eagerly for a fix. |
This reverts parts of nodejs@b488b19 restoring javascript implementation of realpath and realpathSync. Fixes: nodejs#7175 Fixes: nodejs#6861 Fixes: nodejs#7294 Fixes: nodejs#7192 Fixes: nodejs#7044 Fixes: nodejs#6624 Fixes: nodejs#6978
So, as of Node 6.4, the case of the drive letter returned by all the builtin functions is consistent and is determined by the case returned by
Why instead not make it always upper (lower) case? The case returned by Also |
To get rid of problems with lowercase drive letter on Windows you can try this https://www.npmjs.com/package/driveup as a hotfix for this issue. It changes the drive letter the UpperCase:
or to launch your shell:
You can setup |
hmm.. yeah. This looks like a bug in the jest CommonJs implementation. To reproduce it run Create a file
but when running the file with jest it reports: cc @SimenB |
Might have something to do with us running (Playing around with no-oping |
I am facing the same problem on node 14.14.0. On a windows docker I use in a TeamCity build for the following two calls I get different results: I can't reproduce this problem on my local Windows machine. Not sure what's special about how the code is run on the docker |
When cmd.exe is run via a shortcut that has a lowercase drive letter in its 'Start in' field (e.g.
d:\dev
) and Node is run from this cmd instance, Node's builtin functions behave in an unexpected way. Some of them return the drive letter in upper case (D:\dev\foo
) whereas the other in lower (d:\dev\foo
).test.js:
In cmd:
If I change the case of the drive letter in the "Start in" field of the shortcut for cmd, everything becomes consistent.
This leads to issues like webpack/webpack#2362.
So what can be done about it?
d:\test.js
andD:\test.js
as two different modules. Should it stay like this?The text was updated successfully, but these errors were encountered: