env: node: No such file or directory when setting up External Tool
So I installed a tool globally via 'npm install beautify -g' The docs on the tool indicate a simple usage of 'beautify -o <output_file> <input_file>'
So I create an external tool whose PROGRAM is '/usr/local/bin/beautify' (I have confirmed this file exists, though it is a symlink to '/usr/local/lib/node_modules/beautify/bin/beautify.js') I have confirmed that from the Terminal I can type 'beautify' and Terminal finds it, and can confirm that '/usr/local/bin' is in my $PATH.
For PARAMETERS I've foregone using macros for the moment and just put: '-o ./sample/test.beautified.css ./sample/test.css' (I can confirm that from my project root, there IS a '/sample/test.css' file)
For WORKING DIRECTORY I used the macro: $ProjectFileDir$ which shows me as '/Users/<username>/Web/sites/<project_folder>'
However, when I right click a file in the PROJECT WINDOW and run the External tool on the file, my "RUN" window opens with an error:
'/usr/local/bin/beautify -o ./sample/test.beautified.css ./sample/test.css
env: node: No such file or directory
Process finished with exit code 127'
I took the first line and pasted it into a Terminal that was sitting at my project root and BOOM, the file was processed and it created the '/sample/test.beautified.css' file as expected. I can confirm that I setup my Node interpreter and enabled the Node.js Core Library as well. It shows me using 7.4.0 (which is correct), and shows 'beautify 0.0.8' installed and '0.0.8' as the latest.
Ideas?
Please sign in to leave a comment.
What if you use "/usr/local/lib/node_modules/beautify/bin/beautify.js" instead of "/usr/local/bin/beautify" there?
Hey Dmitry, thanks for responding. When updated, I get:
/usr/local/lib/node_modules/beautify/bin/beautify.js -o ./sample/test.beautified.css ./sample/test.css
env: node: No such file or directory
Process finished with exit code 127
I am using the macro $ProjectFileDir$ for the WORKING DIRECTORY. There is a folder called 'sample' and there is a file in it called 'test.css'
Seems Node.js is not found in your $PATH. Try starting PHPStorm from terminal - does the problem persist? What OS are you on? Did you use NVM to install Node?
My Path shows as:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
My which node command shows:
/usr/local/bin/node
So I think it's in the path. I am on OSX El Capitan, 10.11.6
I do not use NVM. The problem does persist if I launch PHPStorm via the terminal.
>The problem does persist if I launch PHPStorm via the terminal.
this is strange, to put it mildly... when started from terminal, it inherits terminal environment, so $PATH should be the same as in terminal.
BTW, does the same command (/usr/local/bin/beautify -o ./sample/test.beautified.css ./sample/test.css) work in your system terminal?
Same problem
I have the similar problem running prettier on my Webstorm 6.0 on my Mac
In terminal I run
which prettier
/usr/local/bin/prettier
which node
/usr/local/bin/node
And in Webstorm External Tools configuration I have
/usr/local/bin/prettier
--write $FilePathRelativeToProjectRoot$
$ProjectFileDir$
And I get the error when I try to run prettier
/usr/local/bin/prettier --write test.js
env: node: No such file or directory
Process finished with exit code 127
In my case was problem that I'm using zsh instead of bash and nvm.
Added:
to
Problem solved.
On Ubuntu 18.04:
If you start IntelliJ by clicking on the icon in the Dash that was automatically added by IntelliJ, you can change this icon's behaviour like this:
Now starting the application will run ~/.bashrc and therefore setup NVM.
@Artur Zubilewicz
Thanks!
Note that one might also find it in: ~/.local/share/applications
@...
Worked also for /bin/zsh