Error running the Salesforce CLI - env: node: No such file or directory

Issue #2382 resolved
Emilio Campa Hoyos created an issue

I updated IntelliJ to version IntelliJ IDEA 2023.1.2 and IlluminatedCloud version 2.2.7.3 and after this I can no longer use the plugin. I am able to execute sfdx commands in the terminal, but whenever I try to use anything from the plugin I get the error “Error running the Salesforce CLI - env: node: No such file or directory“. Even just hovering over the “Tools” and selecting it cause the IDE to crash.

I tried reinstalling sfdx, reinstalling nodeJS and updating brew and still got the same.

Comments (6)

  1. Scott Wells repo owner

    Hi. Nothing has changed in the way that IC2 executes the CLI in quite some time. Based on the error message, it sounds like the IDE’s environment isn’t able to find the node executable in the system execution path. Since you mentioned brew, I’m assuming you’re on a Mac. Often the path used by brew and similar isn’t available to IDE processes started from the dock. Since you can run sfdx from the command-line, you can confirm this difference by starting the JetBrains IDE from the command-line as well by running idea. That will inherit the command-line’s environment including its execution path. My guess is that will work. If so, and if you wish to start the IDE from the dock instead of the command-line, you will need to ensure that node is available via the execution path for processes started from the dock.

    Please let me know if that doesn’t help.

  2. Scott Wells repo owner

    Okay, great. That confirms that it's a Finder/Dock path issue and not an IC2 issue. I'm not as well-versed on Mac as on Windows or Linux, specifically in terms of setting the environment in a way that's picked up by Finder/Dock-launched applications. I think the provided link should help, but if not, my guess is that a quick search should probably turn up a solution. And that's only if you want to start the IDE from Finder/Dock and not from the command-line.

  3. Log in to comment