Вопрос

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top