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, 2021 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, 2021 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, 2021 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, 2021 at 14:39
  • Could be. What does ps -p $$ return in the IDE shell?
    – terdon
    Nov 22, 2021 at 15:05

1 Answer 1

3

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".

3
  • 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
    Nov 29, 2021 at 13:05
  • Ah, in that case you probably need to add the path adding to /etc/profile or similar.
    – faho
    Nov 30, 2021 at 13:04
  • is there a way to automatically add the fish path to /etc/profile? Because whenever I run nvm it changes the path and then I'd have to manually go in and adjust it in this file; I'm wondering if there's a more automatic way of keeping the paths in sync?
    – Luxalpa
    Dec 1, 2021 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .