raycast / script-commands

Script Commands let you tailor Raycast to your needs. Think of them as little productivity boosts throughout your day.

Home Page:https://raycast.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nodejs script error

peixin opened this issue · comments

Source:

#!/Users/xxxx/.asdf/shims/node

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

// Optional parameters:
// @raycast.argument1 { "type": "text", "placeholder": "text"}
// @raycast.packageName xxxx
// @raycast.needsConfirmation false


console.log("Hello World! Argument1 value: " + process.argv.slice(2)[0])

Error:

Reason: Process tried to run, but failed
Domain: scripts
Time: 09:21:25.936
Underlying: 
	Domain: NSPOSIXErrorDomain 8
	Reason: Exec format error

Hey @peixin,

I just tried the code with the place where I have node and it work for me. Therefore, there must be something wrong with your node path. This is the code working in my machine:

#!/usr/bin/env node

// Dependency: This script requires Nodejs.
// Install Node: https://nodejs.org/en/download/

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

// Optional parameters:
// @raycast.argument1 { "type": "text", "placeholder": "text"}
// @raycast.packageName xxxx
// @raycast.needsConfirmation false

console.log("Hello World! Argument1 value: " + process.argv.slice(2)[0])

I am using asdf, which uses nvm under the hood, and now there is no node file in /usr/bin

I wrote Shebang as #!/Users/xxxx/.asdf/shims/node this can run in the command line, but not in Raycast.

At present, I have changed to call Node.js file with bash, which works. or use Python.

Yeah, that is currently not supported. Sorry! I will add it up to the feature request list. Sorry for the inconveniences.

@dehesa Is this feature added? I use nvm and still have this issue.