Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 7: npm uglifyjs "is not recognized as an internal or external command"

I installed npm 2.15.9, works fine anywhere when I open the Command Prompt.

I (allegedly) installed uglifyjs by typing

npm install -g uglifyjs

I tried with and without -g, and I ran it in the folder where I want to use it. Even after doing so and not receiving any error, typing "uglifyjs" or "node uglifyjs" in the CMD terminal return the standard error message - uglifyjs is not recognized as an internal or external command, operable program or batch file."

What am I doing wrong?

EDIT: yes, I tried closing and reopening the CMD window at each step.

like image 568
Emanuele Ciriachi Avatar asked Sep 26 '16 15:09

Emanuele Ciriachi


2 Answers

uglifyjs is deprecated - use uglify-js instead.

npm install -g uglify-js
like image 176
yagoogaly Avatar answered Sep 20 '22 06:09

yagoogaly


  1. Does npm think it's installed? (npm ls -g | findstr uglify should reveal it).
  2. Try npm config get prefix and, with that path:
    • Is that that folder on your %PATH% (echo %PATH%)?
    • Is npm is actually installing the binaries in that folder (dir C:\Users\emanuelec\AppData\Roaming\npm).

It does seem to that 'bin links' are being generated (from your comment above, C:\Users\emanuelec\AppData\Roaming\npm\uglifyjs), so I suspect the npm\ folder is not in your path, or is being clobbered by something.

like image 25
msanford Avatar answered Sep 19 '22 06:09

msanford