-
Notifications
You must be signed in to change notification settings - Fork 293
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
Exception raised: Process failed: spawn node_modules\.bin\jest.cmd ENOENT #98
Comments
Can you provide a demo project? |
I have same problem on macOS |
I'm not using create-react-app, but I am using Windows 10 and struggled with that precise error message with my project for some time and have finally managed to find a functional workaround. The basic issue seems to be with the path finding code on Windows. As a result of the fix to #10, when VSCode is running in a Windows environment this extension naively assumes that everything must end in .cmd, and actually adds .cmd to the end of In the end the only way I could find to satisfy the requirements was to create a text file called
The I hope it works for others too. |
Or you can install jest globally and set the config:
|
Is this one still a problem? Could anyone experiencing the issue provide more info to reproduce the steps or create a sample repo? |
I haven't had time to dig into this deeply, but yes, it's still an issue. Skimming the source code, it looks like the issue is lines 22-24 of Steps to reproduce are basically to install Vagrant and Virtualbox, spin up an Ubuntu (or Linux kernel of your choice) VM, set up a NodeJS project using Jest inside the VM, then point VSCode at the (shared) project folder on the host machine (running Windows). NodeJS was installed inside the (linux) VM so nothing was given the Installing Jest globally on the host machine could possibly work? I haven't tested that - the point of using a virtual machine to develop is to keep the environment as much inside the VM (and as close to your production environment) as possible, so running the tests outside the virtual environment is not a desirable workflow for me. |
Ah, yes! Packages installed from a VM would surely cause problems @Fendrian.
|
Wouldn't it be a little more useful to add the If packages have been restored in a Linux VM is there even a way to to run Jest from command line? |
It's a start, but it misses other package managers like
Great leading question! After playing around with With this information, it makes me think @Fendrian's needs something beyond what we'll offer in the extension. I'd suggest one of these options:
|
I'm a bit confused why there's code adding Personally I'd be inclined to leave code adding As I said in an earlier post, I found a workaround for my issue that allows me to use this plugin with my setup, and it's a wonderful and helpful plugin to use and I definitely appreciate the time and effort that went into it. But the workaround I found is very non-standard and a bit confusing, and it feels a bit needless to me. As a reminder, there are more terminal options available to Windows users than just the base Windows Command Prompt, and there are more methods of ending up with completely functional and legitimate Node and Jest installations that don't have any files that end with |
My primary thought was that the configuration (file) should be shareable between Linux and Windows, which wouldn't be the case if on Windows one has to add '.cmd', which, by the way, is less intuitive, at least in my opinion. It makes me wonder why we even need the '.cmd' extension; I took a short look at vscode-npm-scripts and it seems like they don't use it: vscode-npm-scripts/main.ts. |
Based on the dev environment that you described it sounds like you're an advanced user and can handle yourself. Folks who are new to Node, batch scripts, or are trying to have settings work across platforms may not be familiar with the
We don't have to add anything, ever. We can trust the user and run
Bash on Win 10 sure does complicate things. 😖 How'd you find it? Could you please share your
Following the calls from your code pointer leads to the -- The root cause of this problem is spawning
To simplify our problem to this minimal JS, spawning const {spawn} = require('child_process');
const proc = spawn('npm', ['--version']);
//const proc = spawn('cmd', ['/c', 'npm', '--version']);
proc.stdout.on('data', (chunk) => console.log(chunk.toString()));
proc.on('error', (err) => console.log('error', err));
proc.on('close', () => console.log('close'))
Swap the commented lines to call |
A first step would be to catch the
I tried it on my Windows machine, even there the (working) default setting is just |
Gotcha. vscode-npm-scripts is a calls We can make |
The PR to use the |
My PR (#248 ) basically includes: const useShell = platform() === 'win32'
this.jestProcess = new Runner(this.workspace, { shell: useShell }) Is there a reason not to run in a shell on all other OS? I don't know large the difference is, but my thought would be to keep the behavior across different OS as similar as possible in order to reduce the possibility for introducing new bugs. |
Hey @Fendrian, when you're running in your VM what does |
@Fendrian's problem should be fixed since |
My question for @Fendrian is to figure out if |
Inside the VM and all terminal operations I run, I'm not familiar with the |
As a quick followup, running the latest version with #248 merged, my setting is |
I think even |
I've been messing around with this for a fair while and I can't get it to work. my
I've also tried:
I've validated these files exists, neither work. The error is:
The same
|
|
@stephtr sorry for the late response. Yep I did, it's still throwing errors:
|
@dspacejs did you ever figure out what the right path to jest should be for a multi-root workspace? |
For those who are still getting this error (I just switched to VSCode from Atom), try installing Jest globally without modifying the extension's settings (remove Try that and then restart the VSCode! |
Enable to get this working. Using create-react-app with TypeScript. Any help appreciated
The text was updated successfully, but these errors were encountered: