node.jsuglifyjs2

uglifyjs cli with passing strings instead of filename not working


I tried to use uglifyjs cli with passing inline script strings instead of input file names. According to the documentation, it should work the following way:

"C:\Program Files\nodejs\node.exe" C:\Users\clthck\AppData\Roaming\npm\uglifyjs - "var a = 5;"

But this throws me the following error:

C:\Users\clthck\AppData\Roaming\npm\uglifyjs:4
case `uname` in
SyntaxError: Unexpected token case
    at exports.runInThisContext (vm.js:54:16)
    at Module._compile (module.js:375:25)
    at Object.Module._extensions..js (module.js:406:10)
    at Module.load (module.js:345:32)
    at Function.Module._load (module.js:302:12)
    at Function.Module.runMain (module.js:431:10)
    at startup (node.js:141:18)
    at node.js:977:3

What am I doing wrong here? I've been googling over a couple of hours but no luck.


Solution

  • I figured it out. I replaced C:\Users\clthck\AppData\Roaming\npm\uglifyjs to C:\Users\clthck\AppData\Roaming\npm\node_modules\uglify-js\bin\uglifyjs and it worked.