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

Sometimes npm cannot find files. #4632

Closed
shaunluttin opened this issue Oct 31, 2019 · 2 comments
Closed

Sometimes npm cannot find files. #4632

shaunluttin opened this issue Oct 31, 2019 · 2 comments

Comments

@shaunluttin
Copy link

shaunluttin commented Oct 31, 2019

Your Windows build number: Microsoft Windows [Version 10.0.17134.1006]

What you're doing: /node_modules/.bin/jest -c jest/config.base.js

What's wrong is that sometimes files are not found. The files that are not found change from one test run to another. In some test runs, all files are found, in others, very few files are found. Sometimes for ten test runs, npm cannot find files, and then on the 11th test run, it can find the files.

Here is a sample of some of the errors we see.

ENOENT: no such file or directory, open '/mnt/c/dev/proj/node_modules/lodash/_mapCacheSet.js'
[BABEL] /mnt/c/dev/proj/src/libraries/jestExtensions/index.ts: ENOENT: no such file or directory, lstat '/mnt/c/dev/proj/node_modules/@babel/helper-create-class-features-plugin/node_modules/@babel/types/lib/traverse' (While processing: "/mnt/c/dev/proj/node_modules/@babel/plugin-proposal-class-properties/lib/index.js")
Cannot find module './lib/state.js' from 'parallel.js'                                                                                                                                                                                                                              
However, Jest was able to find:                                                                                                           
    './request.js'                                                                                                                        
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'ts'].
See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string                                                                                                                                                      
However, Jest was able to find:                                                                                                           
    '../utils.js'                                                                                                                         

What should happen instead is that test runs should completes reliably. If we run the tests once, and they all pass, then on an 2nd run immediately after, the tests should pass (whereas now, on the nth run, sometimes files are not found, as above).

Some additional information that might be useful.

  • We have Node and NPM installed only in WSL.
  • We have one version of Node: v8.16.2.
  • We have one version of NPM: 6.4.1.
  • We have VS Code installed and are using it via its WSL extension.
  • We are running the npm command through bash directly (not through VS Code).
  • We are clearing the jest cache each test run.
  • We have tried uninstalling and reinstalling Node.
  • We have tried restarting WSL Get-Service LxssManager | Restart-Service.
  • We have tried deleting and reinstalling the node_modules directory.
  • We have disabled all anti-virus-related software including Windows Defender.
  • We have read this related issue: Issue running npm command #1512
  • This issue does not happen on other machines running non-WSL systems.
@shaunluttin
Copy link
Author

shaunluttin commented Oct 31, 2019

Moving the project from /mnt/c/dev/proj/ to /home/dev/proj/ might have resolved the situation.

Related #873

@therealkenc
Copy link
Collaborator

This is #14 aka #2097 aka landing zone #1529. TL;DR, reading the duplicates won't move you forward despite their length, because the latter is still open. Operating on /home will help, as you have already surmised. Using WSL2 will help even more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants