1

I'm specifically trying to get NVM to work on Elementary OS with Fish and IntelliJ.

There is a fish script that works pretty well as long as I stay in the terminal. However, when I launch my IDE from my desktop environment it does not inherit the path modifications made by that fish script. From my guess this is because it's still reading in ~/.profile when launching applications, but does not get any access to the variables set inside the fish config.

What's the proper way to resolve this? Maybe there's a way to load the fish env when launching an application? Or should I simply not use fish_add_path etc, avoid fish's nvm and use the bash variant inside ~/.profile? Or is there another solution?

6
  • Your IDE will presumably be running your default $SHELL. Either that, or it just defaults to sh. What does echo $SHELL return? Do you have it set to fish? If not, try running chsh to default to fish and then relaunching your IDE. Does that solve it?
    – terdon
    Nov 19 at 11:54
  • @terdon I ran chsh and my normal terminal is running fish (same with the one inside intelliJ). I'm launching my IDE from the window manager though, not from the terminal, so my guess is that the terminal is inheriting my env from the window manager, which does not seem to inherit it from fish at any time.
    – Luxalpa
    Nov 20 at 12:17
  • So echo $SHELL returns /bin/fish? Does it return the same thing when run in a terminal and when run within your IDE?
    – terdon
    Nov 20 at 12:24
  • Yes, in both the terminal and the IDE's Terminal they return /usr/bin/fish. But I don't know how exactly the IDE spawns this terminal (I don't normally use it as it's too slow for fish and right now it shows a bunch of errors like error: Unable to open universal variable file '/': Read-only file system which I'm guessing is because it's installed by snap). Now that I think about it, maybe it could also be a snap-related issue?
    – Luxalpa
    Nov 22 at 14:39
  • Could be. What does ps -p $$ return in the IDE shell?
    – terdon
    Nov 22 at 15:05
0

Intellij has some special fish integration that is unfortunately rather broken.

Your best fix is to go to the IntelliJ settings and turn off "Shell integration".

2
  • yes indeed I am not using IntelliJ's fish integration, my issue is with intellij itself, specifically Settings -> Languages & Settings -> Node.js and NPM dialog which is not recognizing my Node interprester and package manager with fish's NVM, as fish seems to be only adding the paths to its own shell, but not to the system as a whole. So while fish (even the one in intellij) can read out the yarn and node command paths from its configuration, intellij just can't find anything.
    – Luxalpa
    yesterday
  • Ah, in that case you probably need to add the path adding to /etc/profile or similar.
    – faho
    8 mins ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.