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?

5 comments

What if you use "/usr/local/lib/node_modules/beautify/bin/beautify.js" instead of "/usr/local/bin/beautify" there?

0

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'

0

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?

0

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.

0

>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?

0

Please sign in to leave a comment.