Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

env: node: No such file or directory in phpstorm when compiling less

I'm trying to compile my main.less file to a main.css file using phpstorm. However, I'm getting this error and the .less file does not compile.

/usr/local/bin/lessc main.less
env: node: No such file or directory

Process finished with exit code 127

I'm using a mac and not sure why this is happening. It was working fine before, but I restarted my computer and now I'm getting this error.

Does anyone know why this is happening and how to fix?

like image 418
xslibx Avatar asked Dec 08 '22 00:12

xslibx


1 Answers

Seems Node is not found in your PATH. PHPStorm normally uses your environment variables to figure out tools locations. But on MacOSX the environment variables differ between GUI applications and within the terminal. PHPStorm tries to load terminal environment on startup by executing the following command on startup:

-l -i -c '/Applications/PHPStorm.app/bin/printenv.py'

Seems this command either fails or can't retrieve all needed stuff. Can you check if the problem persists when running PHPStorm from system terminal (open -a /Applications/PHPStorm.app)? And one more thing to check: please open your Less file watcher settings, press ellipsis button in 'Environment variables' field to view variables - do you have 'Include parent environment variables' enabled? If this option is disabled, system environment variables won't be available to file watcher

like image 162
lena Avatar answered Dec 11 '22 09:12

lena