0
votes

I'm trying to build jQuery from source, and I'm running into an odd problem.

I can build the un-minified version, but when it tries to minify the js file, I get the following errors:

> make
...
Building ./dist/jquery.js
/bin/sh: line 0: test: /usr/bin/node: binary operator expected
You must have NodeJS installed in order to minify jQuery.
/bin/sh: line 0: test: /usr/bin/node: binary operator expected
You must have NodeJS installed in order to test jQuery against JSHint.
/bin/sh: line 0: test: /usr/bin/node: binary operator expected
You must have NodeJS installed in order to size jQuery.

What's weird, though, is that NodeJS is installed at /usr/bin/node. What's going on here?

1

1 Answers

1
votes

Check out one of the lines that generates the error:

@@if test ! -z ${JS_ENGINE}; then \

Here's where ${JS_ENGINE} is defined at the top of Makefile:

JS_ENGINE ?= `which node nodejs 2>/dev/null`

If I run that command on my system, here's what I get:

> which node nodejs 2>/dev/null
/usr/bin/node
/usr/bin/nodejs

Notice that the output contains 2 lines, not 1!

To fix this, override the ${JS_ENGINE} property when you invoke make like so:

make JS_ENGINE=`which node nodejs 2>/dev/null | head -n 1`