-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Paths are not normalized on Windows, causing duplicates #3752
Comments
@Venryx, are you still experiencing this issue? And are you still working around it as above? I'm seeing it on my machine but my colleague is somehow not experiencing this. OS: Microsoft Windows 10 Enterprise (Version 1703, OS Build 15063.540) Watchman version: 4.9.0 |
Isn't this fixed by #4018? |
I'd guess so. @Venryx could you check? |
Should be fixed by #5553 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
For package: jest-haste-map
What is the current behavior?
Running the react-native packager (
react-native start
) with watchman enabled (ie. in the path) fails on Windows.This is because the paths that are put into jest-haste-map do not have consistent path-separators.
For my project, I did a test to show this.
In "C:\Root\Apps@V\LucidLink\Main\node_modules\jest-haste-map\build\HasteFS.js", I added the following lines:
When I ran "react-native start", I then got these results:
Note that forward slashes are used everywhere except for the divide between the root folder and the folder under it.
This causes problems, because the other scripts, which call the HasteMap.exists method, pass in file-paths which follow a different pattern (they're all backslashes, as per Windows). This means that the
HasteMap.exists
method returns "false" for many file-paths which, in fact, exist. This causes real-files to appear to be missing, causing module-not-found errors.Here's an example of the error: (when the file does in fact exist -- even when copied into both roots)
It also causes duplicate entries to be added to the HasteMap, causing duplicate-module warnings.
Here's an example of the warnings it causes:
This took me about 10 hours to track down, because I followed many false and halfway-fixing leads before finally coming across the root issue. (stumbling around in react-native's javascript files is not exactly my speciality)
What is the expected behavior?
The HasteMap class should normalize all stored file-paths, and the file-paths compared with those in the store.
This is pretty straight-forward. In my case, I fixed the problem by making these changes, to the "jest-haste-map\build\HasteFS.js" file:
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
OS: Microsoft Windows 10 Pro (Version 10.0.14393 Build 14393)
node: 6.9.1
npm: 3.10.8
jest: 17.0.2
jest-haste-map: 18.0.0
End note
Please consider adding these changes (or an equivalent), as it is quite hard to track down for end-users!
I don't know what caused my project to have this issue, without being the case for all watchman-enabled Windows projects. It's possible it was caused by some kind of misconfiguration.
But even if that's the case, it's still a serious problem because:
Anyway, for reference, here is the project I encountered the issue in: https://github.com/Venryx/LucidLink
And here is a thread with some other background on the issue: facebook/react-native#9136 (comment)
I know providing a direct repro project is easier for debugging, but in this case the problem and solution are straight-forward enough that I don't think it's necessary. (and I've spent an awful lot of time on this issue already)
If you need any specifics from my project though, feel free to ask, and I'll provide them here for convenience.
The text was updated successfully, but these errors were encountered: