Open Jamesking56 opened 1 year ago
Hi James, Do you mean that the problem is only present for the 'all tests inside of a directory' mode? Can you post the entire first line of the console output (the one with start command)?
@mbolotov Yes exactly, here is the output in PHPStorm's test window (had to censor the project name as its confidential):
/home/jamesking56/.nvm/versions/node/v16.16.0/bin/npx cypress run --reporter /tmp/intellij-cypress-reporter12805111157771413441.js --spec /home/jamesking56/PhpstormProjects/{censored}/tests/cypress/**/*
/usr/bin/env: ‘node’: No such file or directory
can you also provide the command for a single test which is working okay? what's the difference?
Single tests aren't working OK and are showing the same error
It's a bit hard to reproduce the problem as I'm on Windows mostly of the time. So you mean when you run this command directly in terminal, it working okay?
cd /home/jamesking56/PhpstormProjects
npx cypress run --spec /home/jamesking56/PhpstormProjects/{censored}/tests/cypress/**/*
Also, you could try creating a symlink as described here: https://stackoverflow.com/questions/26320901/cannot-install-nodejs-usr-bin-env-node-no-such-file-or-directory
Yes that command works in the terminal as normal and I've added the symlink and it does not fix the issue
this might be related to the user under you run PHPStorm itself. is it the same user as the one use in terminal?
Yes it is the same user, installed via Jetbrains Toolbox
you can also play with the settings on runner
tab:
if you clear the
Package Manager
field, you'll be able to select and use a NodeJS interpreter directly.
Today I faced this as well. It was working for quite a while until today when I updated node via nvm from 16.14.2 to 16.17.0.
Clicking "Run all tests in cypress" opens runner window where it is clearly seen that old node version is chosen (that was deleted after an update)
Specifying correct paths to node lead to runner starting with error just like topicstarter reported.
Webstorm correctly identified new node version
Everything else works with new node as expected without any issues. I tried restarting webstorm, clearing it's cache, completely reinstalling plugin.
WebStorm 2022.2.1 Build #WS-222.3739.57, built on August 16, 2022 Runtime version: 17.0.3+7-b469.37 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 5.15.0-46-generic GC: G1 Young Generation, G1 Old Generation Memory: 1926M Cores: 16 Non-Bundled Plugins: net.vektah.codeglance2 (1.5.5) me.mbolotov.cypress (1.5) Current Desktop: X-Cinnamon
I have the same issue, also using nvm and linux. Tried running a single test but it failed.
UPDATE: I worked around the problem by installing a new version of node using Snap Store (I'm on Ubuntu).
So maybe the problem is handling of node versions installed via nvm
?
This is due to the fact that from where PHPStorm/Webstorm is started, the correct terminal config / env vars are not present. When starting PHPStorm/Webstorm from the terminal it probably works. See https://youtrack.jetbrains.com/issue/IDEABKL-7589
When I run Cypress inside of PHPStorm to run all tests inside of a directory, I get:
Node is definitely present, as cypress runs fine normally in the terminal. I've checked the run configuration and it all points to the correct Node paths...
Any ideas what else I can check here?
I'm running PHPStorm 2022.2 on PopOS 22.04