I'm trying out the JS minifier library UglifyJS2. I installed node.js on my mac using homebrew, and then uglifyjs through npm. It all works fine in the shell, node is found in the path and I manually added "uglifyjs" to the path so can find it just by typing "uglifyjs" (it is installed here: /usr/local/share/npm/lib/node_modules/uglify-js/bin/uglifyjs). This is done in ".bash_profile".
So, I can run everything fine in the terminal. I would now like to run it in a web context, in a Php page, using php's "exec". However, when I try to do that, exec returns status code '127', which I think means "command not found". I tried calling the complete path above too, but with the same result. My web server is running as the same user as i use in the shell.
The uglifyjs program starts like this, maybe that's a problem?
#! /usr/bin/env node // -*- js -*- ...
Is there any way you know of to do this? Thanks
A symlink in "/usr/bin" did the job:
sudo ln -s /usr/local/bin/node node
There is currently no discussion for this recipe.
This recipe can be found in it's original form on Stack Over Flow.