Skip to content Skip to sidebar Skip to footer

How To Install Node Modules Globally?

I have zero experience with npm other than knowing it exists. I believe I have managed to install uglify, but I have no idea how to use it. I had until recently been using Yuicompr

Solution 1:

To run it from the command line, you have to install it globally

C:\Data\Websites\local\htdocs\b>npm install uglify-js -g

Also, the name of the executable is uglifyjs

C:\Data\Websites\local\htdocs\b>uglifyjs

Solution 2:

Even though you installed the package uglify-js, to actually use it, it is: uglifyjs. So using your example, it would be something like:

C:\Data\Websites\local\htdocs\b>uglifyjs [ options... ] [ filename ]

Where options are parameters like: --compress, and a filename would be whatever JS file you want to uglify. e.g. uglifyjs --compress --mangle -- input.js


Solution 3:

There is a 'Usage' section on the repo's README.

uglifyjs [ options... ] [ filename ]

Post a Comment for "How To Install Node Modules Globally?"