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

/usr/bin/env: ‘node’: No such file or directory #101

Open
Jamesking56 opened this issue Aug 13, 2022 · 12 comments
Open

/usr/bin/env: ‘node’: No such file or directory #101

Jamesking56 opened this issue Aug 13, 2022 · 12 comments

Comments

@Jamesking56
Copy link

When I run Cypress inside of PHPStorm to run all tests inside of a directory, I get:

/usr/bin/env: ‘node’: No such file or directory

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

@mbolotov
Copy link
Owner

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)?

@Jamesking56
Copy link
Author

@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

@mbolotov
Copy link
Owner

can you also provide the command for a single test which is working okay?
what's the difference?

@Jamesking56
Copy link
Author

Single tests aren't working OK and are showing the same error

@mbolotov
Copy link
Owner

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

@Jamesking56
Copy link
Author

Yes that command works in the terminal as normal and I've added the symlink and it does not fix the issue

@mbolotov
Copy link
Owner

this might be related to the user under you run PHPStorm itself.
is it the same user as the one use in terminal?

@Jamesking56
Copy link
Author

Yes it is the same user, installed via Jetbrains Toolbox

@mbolotov
Copy link
Owner

you can also play with the settings on runner tab:
image
if you clear the Package Manager field, you'll be able to select and use a NodeJS interpreter directly.

@Threnos
Copy link

Threnos commented Aug 31, 2022

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)
image
Specifying correct paths to node lead to runner starting with error just like topicstarter reported.

Webstorm correctly identified new node version
image

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

@list4c
Copy link

list4c commented Dec 10, 2022

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 ?

@jippeholwerda
Copy link

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

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

No branches or pull requests

5 participants