Cannot run UglifyJS standalone after installing globally in Windows #1994

Closed
jcreamer898 opened this Issue Jan 5, 2012 · 2 comments

2 participants

@jcreamer898

I am trying to run UglifyJS standalone, and here are the steps I have taken.

  1. Open Command Prompt
  2. Run npm -g install uglify-js
  3. Run uglifyjs -o app.min.js app.js

The following error is recieved...

C:\Users\jcreamer>"C:\Users\jcreamer\AppData\Roaming\npm\\.\node_modules\uglify-js\bin\uglifyjs"
'"C:\Users\jcreamer\AppData\Roaming\npm\\.\node_modules\uglify-js\bin\uglifyjs"' is not recognized as an internal or external comm and, operable program or batch file.
@isaacs
npm member

There's a space in the uglify-js bin file, confusing the cmd writer. Related: mishoo/UglifyJS#291

Fixing in next version of npm. In the meantime, you can manually edit C:\Users\jcreamer\AppData\Roaming\npm\uglifyjs in notepad (or your favorite text editor), ignore the warning, and make it contain this instead:

:: Created by npm, please don't edit manually.
@IF EXIST "%~dp0"\"node.exe" (
  "%~dp0"\"node.exe"  "%~dp0\.\node_modules\uglify-js\bin\uglifyjs" %*
) ELSE (
  node  "%~dp0\.\node_modules\uglify-js\bin\uglifyjs" %*
)
@isaacs isaacs added a commit that closed this issue Jan 5, 2012
@isaacs isaacs Fix #1994 Allow spaces in #! lines d1a8ca9
@isaacs isaacs closed this in d1a8ca9 Jan 5, 2012
@jcreamer898

Works with that update! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment