Reputation: 4349
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?
Upvotes: 4
Views: 4259
Reputation: 1
I had this issue when I upgraded to Monterey OSX. I could see the ENV path in my file watcher in phpstorm was not matching my terminal command line path. So I updated PHPStorm and then the correct ENV path was showing up in PHPStorm and everything worked again. So broke by an OS upgrade and fixed by PHPStorm upgrade.
Upvotes: 0
Reputation: 373
Had this problem with uglify-js but it's the same thing. Turned out to be caused by using nvm, which nests the node root. Fixed it by following @funivan comment to create a symlink pointing to my (default) node version under nvm.
sudo ln -s /home/[usr]/.nvm/versions/node/[v8.9.1]/bin/node /usr/bin/node
Upvotes: 5
Reputation: 6950
This was happening to me because I had node installed via nvm
, and nvm
installed via homebrew, which is not officially supported. I deleted nvm
completely and reinstalled it using the official install script, reinstalled node via nvm
, and the error went away.
See nvm is not compatible with the npm config “prefix” option for more information.
Upvotes: 3
Reputation: 93728
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
Upvotes: 6