IDE can't find or execute node after the sfdx executable is set up

Issue #2115 resolved
Renato Oliveira created an issue

After installing the IDE and setting up the path to SFDX, there are multiple instances of those messages saying that “node” is not a file or directory popping up on the notification area, although NodeJS is installed and works perfectly fine with the VSCode extensions:

Is there any additional setup to do for the extension on a Linux machine?

IntelliJ IDEA 2022.1.1 (Community Edition)
Build #IC-221.5591.52, built on May 10, 2022
Runtime version: 11.0.14.1+1-b2043.45 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.17.5-76051705-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 1948M
Cores: 8
Non-Bundled Plugins:
com.arcticicestudio.nord.jetbrains (0.13.0)
com.illuminatedcloud2.intellij (2.2.2.1)

Kotlin: 221-1.6.21-release-337-IJ5591.52
Current Desktop: pop:GNOME

Comments (5)

  1. Scott Wells repo owner

    My guess is that the IDE process isn't running with the same environment as the command-line. You can see exactly how IC2 is running the CLI by enabling Illuminated Cloud > Configure Application > Salesforce DX > Log Salesforce CLI commands. With that enabled, all Salesforce CLI command execution will be output into a tab of the Messages tool window. This will include the exact command-line used, the working directory, the environment passed to that command, and of course the CLI's exit code and output. Make sure that the Salesforce CLI commands executed there look correct and match what works from the command-line.

  2. Renato Oliveira reporter

    The output displayed at the Messages tool window looks like this:

    Command line
    ============
    /home/renato/.yarn/bin/sfdx force:org:list --skipconnectionstatus --json
    
    Environment variables
    =====================
    SFDX_AUTOUPDATE_DISABLE = true
    SFDX_JSON_TO_STDOUT = true
    
    Duration
    ========
    1 s 3 ms
    
    Exit code
    =========
    127
    
    Output
    ======
    
    
    Error
    =====
    /usr/bin/env: ‘node’: No such file or directory
    

    Whereas if I run from a terminal, it outputs just fine:

    renato@pop-os:~$ node --version
    v16.15.0
    

    Does it make a difference if IntelliJ is installed through Flatpak, for example?

  3. Scott Wells repo owner

    From the command-line, type which node. It will show where in the path that executable is found. Then please make sure that is part of the execution path that's available to the IDE process when it runs. My guess is that it's not right now.

  4. Renato Oliveira reporter

    You are right, I did some research and it seems to be something related to how Flatpak apps access the command line and environment variables. For now I’ve removed the Flatpak version and downloaded it directly from Jetbrains' website and it works. Proof of it is that the Connections column after creating a new project works and displays all orgs registered locally through SFDX.

    Might be a good idea to warn about this path thing in the documentation, especially for Linux installs.

  5. Scott Wells repo owner

    Thanks for the update. Resolving this one. Let me know if you have anything new to report on the other one.

  6. Log in to comment