Get `env: node: No such file or directory` error when run `babel` in Intellij

I am using Intellij ultimate 2017.3 and installed nodejs plugin on it. My nodejs project requires babel to do the translation work from es5 to es6. In order to make Intellij to be able to debug my nodejs process, I added a file watcher plugin to listen on the source code changes. Once a file is changed, it will run below command to translate the code:

babel ./src --out-dir ./lib --source-maps

this command works fine from my OS but I get below error in Intellij:

env: node: No such file or directory

Process finished with exit code 127

I am using MacOS 10.13.1 and my node is managed by nvm which is at the v8.9.1. Babel is 6.26.0. Is there any problem in Intellij to call babel command? Or is it a babel or node environment problem on my OS?

2
4 comments

Must be a $PATH issue. Can you check if the problem persist when running IDEA from terminal (open -a /Applications/idea.app )?

on MacOSX the environment variables differ between GUI applications and within the terminal. Terminal environment is only available to applications started from terminal.
To solve this problem, IDEA tries to load terminal environment by executing the following command on startup:

<your shell> -l -i -c '/Applications/idea.app/bin/printenv.py'

Seems this command can't retrieve all needed stuff in your case - thus the issue.

Some links you may find useful: http://apple.stackexchange.com/questions/106355/setting-the-system-wide-path-environment-variable-in-mavericks, https://devnet.jetbrains.com/docs/DOC-1160#comment-2801, http://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications.. The problem is that the way to define system-wide environment variables on Mac changes from one version to another (even minor system updates may break your environment)

-1
Avatar
Permanently deleted user

Thanks for your response. Open from terminal works so the issue relates to path when opening from finder. Probably I have to open Intellij from terminal every time.

0

Can you provide your idea.log (https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files) so that I can check if there are issues with environment loading? Please don't paste the log here, put it on some file server and publish a link

0

Simply because I end up here with the same problem, but a simple switch of settings fixed the issue for me I decided to post it here.

When I switched path to Node interpreter to the one which had title "node" in front, all started working. 

Somehow I had the same path selected but without the word "node" in front, when clicked on the button on the right with 3 dots I had this option revealed. 

1

Please sign in to leave a comment.