Webstorm not inferring nodejs path

Hey guys,

I am nearly at the point of getting insane. Every time I launch webstorm via Alfred, Spotlight or directly, it doesn't infer my PATH vars. This results in the nodejs path missing. My workaround is to close webstorm again and open it with "webstorm ." in the terminal. 

I already tried to set the path in the following files (and all together):

  • .profile
  • .zprofile
  • .bash_profile
  • .zshenv
  • .zshrc

This yield in no result. I use fnm for node version management which forks just fine for every other app (like vscode etc). 

export PATH=/usr/local/bin/:$PATH
eval "$(fnm env --use-on-cd)"

This should totally work, because the PATH gets set with this and fnm is definitely available.  

I still don't get why the intelli ideas don't have proper support for any node version management. 

Any idea for this? I don't want to hard link the node executable.

0
11 comments

I'm not sure fnm is supposed to work in GUI apps (i.e. in those apps that aren't started from terminal); to examine the environment variables that are effective when you start the app from desktop, etc., you can follow the guidance in this Ask Ubuntu answer

0

fnm just adds the bin directory of the current node version to the path and removes the older ones. This worked a few versions ago. Sadly the ask ubuntu link doesn't help me, because I am on macOS. In the integrated terminal it works just fine btw. 

0

what IDE version do you use? We have a known issue with loading shell environment on Mac in 2022.1 -  IDEA-289094. Do you have any additional logging (iTerm2 shell integration, for example) configured in your shell profile?

0

This seems to be the issue. Removed the iterm integration and it instantly worked. 

Build #WS-221.4906.8, built on March 3, 2022

Replacing the integration with

test -n "${ITERM_SESSION_ID}" && test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"

worked.

 

0

I did what noim suggested and it's still not working here.

0

Please see the  KB article for troubleshooting the issue.

-1

Elena Pogorelova Respectfully, that's not an article, it's just a forum post with a lot of comments – just like this one.

An actual article would have a series of steps to resolve the issue, not a bunch of back & forth comments of users having to try and debug it themselves.

0

Elena Pogorelova I've reviewed everything in that post (which doesn't even mention FNM), and there's no new info. Is there a bug ticket for this or should I create one?

0

Hi, could you please click the IDE main menu `Help | Collect Logs and Diagnostic Data` to get the IDE logs, and upload it in https://uploads.jetbrains.com/, share us the upload id for investigating your issue?

0

I had a problem where WebStorm (Windows) couldn't detect Node.js installed with fnm, showing the error "No executable found in %PATH%". After some investigation, I found the solution:

The solution that worked for me

I added this line to my PowerShell profile ($PROFILE):

[System.Environment]::SetEnvironmentVariable("FNM_DIR", "$env:APPDATA\fnm", [System.EnvironmentVariableTarget]::User)

Why it worked 

  • Sets a consistent location for fnm in %APPDATA%\fnm
  • Makes the path persistent across sessions
  • WebStorm can now automatically find Node.js
  • Improves integration with Windows

My complete configuration

In my $PROFILE I have:

# This was already there
fnm env --use-on-cd --shell powershell | Out-String | Invoke-Expression

# This is the line I added that fixed everything
[System.Environment]::SetEnvironmentVariable("FNM_DIR", "$env:APPDATA\fnm", [System.EnvironmentVariableTarget]::User)

After adding this and restarting PowerShell, everything started working perfectly! WebStorm detected Node.js without any issues and I didn't have to manually configure anything in the IDE

1

I had this problem, but adding this [System.Environment]::SetEnvironmentVariable("FNM_DIR", "$env:APPDATA\fnm", [System.EnvironmentVariableTarget]::User) to my $profile haven't helped me.

But this adding this %AppData%\fnm\aliases\default to Path may help you, at least it helped me

0

Please sign in to leave a comment.