UglifyJS using NPM in Windows
Global installs are for command-line utilities.
As you can see the uglifyjs
command line utility is dropped into your path, at C:\Users\jcreamer\AppData\Roaming\npm\uglifyjs
(which is a link to uglify's bin\uglifyjs
as you can see in the output.)
@alessioalex You no longer need admin packages to install a global package. The node MSI installer sets the global default prefix to %APPDATA%\npm
, so users have the ability to write to it.
If you're trying to require("uglify-js")
in your node program, then you should install it locally, not with the -g. It looks like you're trying to use it as a standalone util, so alessioalex's #2 suggestion is exactly right. Just type uglifyjs
to use it, not node uglifyjs
.
You can do two things:
Run the command prompt with administrator privileges when installing a global package like this one (right click -> Run as administrator).
Instead of
node uglifyjs...
useuglifyjs
directly. Since it's installed globally you don't need to call it with node in front, that makes no sense.