Intellij terminal integration broken when trying to use node/nvm
Hello, something has been bothering me for a while. I develop using a couple of different versions of node. While I can set the node interpreter in preferences > languages and frameworks > node and npm, it does not change the node version for the integrated terminal and VCS window. For the terminal, my workaround is to just "nvm use x" after opening the terminal. The VCS is useless though, as I cannot type commands into that window. So any git pre-hooks will fail if they depend on a different version of node. And I am (ugh) forced to use command line git tools.
So I tried a different method I found using an rc file as the input to my shell command. I use ohmyzsh, and added the following under the shell path:
/bin/zsh --rcs .idea/.zshrc
which contains:
source .idea/.zshrc
~/.nvm/nvm.sh use 0
This works fine in the Mac terminal. But the terminal window in Intellij immediately closes and I get the following error:
2019-02-27 14:56:01,465 [1189585] WARN - erminal.AbstractTerminalRunner - Cannot resize right after creation, process.isAlive: true
java.lang.IllegalStateException: Can set new window size. ioctl returns -1, errorno=25
at com.pty4j.unix.Pty.setTerminalSize(Pty.java:114)
at com.pty4j.unix.UnixPtyProcess.setWinSize(UnixPtyProcess.java:343)
at com.jediterm.pty.PtyProcessTtyConnector.resizeImmediately(PtyProcessTtyConnector.java:24)
at org.jetbrains.plugins.terminal.LocalTerminalDirectRunner$1.resizeImmediately(LocalTerminalDirectRunner.java:220)
at com.jediterm.terminal.ProcessTtyConnector.resize(ProcessTtyConnector.java:42)
at com.jediterm.terminal.TerminalStarter.resizeTerminal(TerminalStarter.java:87)
at org.jetbrains.plugins.terminal.AbstractTerminalRunner.lambda$openSessionInDirectory$5(AbstractTerminalRunner.java:216)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2019-02-27 14:56:32,572 [1220692] ERROR - terminal.emulator.JediEmulator - Error processing OSC 1;
Please sign in to leave a comment.
There is an open issue for this Terminal bug at https://youtrack.jetbrains.com/issue/IDEA-206723, please follow for updates.
You can change only PATH for the Terminal so that different version of node is used. Your custom script may be changing something else which is causing this Terminal bug.
Something like
in your shell startup script.