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

env: node: No such file or directory #558

Closed
Daroocky opened this issue Aug 20, 2021 · 5 comments
Closed

env: node: No such file or directory #558

Daroocky opened this issue Aug 20, 2021 · 5 comments

Comments

@Daroocky
Copy link

When I create a script via "Extensions" > "Scripts" > "Create script command" and choose "NodeJS" as template, I get the following error message when I run the script: "env: node: No such file or directory".

I have NodeJS installed on the system via NVM and when I run the script directly from the terminal, everything works fine. But I can't get it to launch in Raycast.

Thats the (default) script:

#!/usr/bin/env node

// Required parameters:
// @raycast.schemaVersion 1
// @raycast.title test
// @raycast.mode fullOutput

// Optional parameters:
// @raycast.icon 🤖

console.log("Hello World!");
@unnamedd
Copy link
Collaborator

First question I need to bring here @DreiAugenFrosch: is your Node installed globally?

Raycast runs in a non-login environment, if node is only installed for your user, Raycast won’t be able to find it and then you will receive the message “No such file or directory”.

A test you can do is changing your shebang to make Raycast run in login environment.

Follow the instructions in our Troubleshooting and Faqs.

@unnamedd
Copy link
Collaborator

As this issue didn't get any interaction from the original author, I'm closing it to keep clean our list of issues.

@svenjacobs
Copy link

I have the same issue. I use Volta to manage multiple Node versions. The node executable is placed in $HOME/.volta/bin. Currently I have to add the following shebang to my scripts

#!/usr/bin/env PATH=$PATH:/Users/sven.jacobs/.volta/bin node

which however doesn't make my scripts very portable because of the hardcoded path. What other options are there?

@axhamre
Copy link

axhamre commented Jan 10, 2023

@unnamedd Would you mind giving an example how to run the script as login-shell with Node.js?

@ubuntudroid
Copy link
Contributor

I'm using nvm, but I cannot figure out how to make this work except for if I run

/Users/ubuntudroid/.nvm/versions/node/v18.20.0/bin/node

This obviously isn't portable, and even worse, it points to a specific node version and thus won't benefit from any node updates on the host machine. 🤔

I would like to at least have something like what nvm run provides (that is, use the node version defined in the local .nvmrc or, if none, fall back to the node version defined in ~/.nvmrc).

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