I want to minify a folder automatically by a command line. I then installed npm install -g minify-all
, then minify-all /opt/myapp/
. It gives:
minify-all /opt/myapp/
found file: /opt/myapp/addin_online/css/Common.css
/usr/local/lib/node_modules/minify-all/node_modules/node-minify/lib/node-minify.js:104
throw new Error(bin + ' not found !');
^
Error: uglifyjs not found !
at getPath (/usr/local/lib/node_modules/minify-all/node_modules/node-minify/lib/node-minify.js:104:17)
at Object.compress (/usr/local/lib/node_modules/minify-all/node_modules/node-minify/lib/node-minify.js:132:27)
at Object.minify (/usr/local/lib/node_modules/minify-all/node_modules/node-minify/lib/node-minify.js:83:10)
at /usr/local/lib/node_modules/minify-all/index.js:30:13
at /usr/local/lib/node_modules/minify-all/index.js:14:13
at Array.forEach (native)
at walk (/usr/local/lib/node_modules/minify-all/index.js:10:36)
at /usr/local/lib/node_modules/minify-all/index.js:16:13
at Array.forEach (native)
at walk (/usr/local/lib/node_modules/minify-all/index.js:10:36)
Does anyone know how to fix this? Is minify-all
the right package to use?
Edit 1: I tried sudo npm install uglify-js -g
/usr/local/bin/uglifyjs -> /usr/local/lib/node_modules/uglify-js/bin/uglifyjs
/usr/local/lib
└─┬ uglify-js@3.0.11
├─┬ commander@2.9.0
│ └── graceful-readlink@1.0.1
└── source-map@0.5.6
And sudo npm install uglify-js -save--dev
under /opt/myapp/
async@0.2.10 node_modules/uglify-js/node_modules/async -> node_modules/swig/node_modules/async
flapper-news@0.0.0 /opt/myapp
├─┬ swig@1.4.2
│ └─┬ uglify-js@2.4.24
│ └── source-map@0.1.34
└─┬ uglify-js@3.0.11
├─┬ commander@2.9.0
│ └── graceful-readlink@1.0.1
└── source-map@0.5.6
However, minify-all /opt/myapp/
still shows:
found file: /opt/myapp/addin_online/css/Common.css
/usr/local/lib/node_modules/minify-all/node_modules/node-minify/lib/node-minify.js:104
throw new Error(bin + ' not found !');
^
Error: uglifyjs not found !
at getPath (/usr/local/lib/node_modules/minify-all/node_modules/node-minify/lib/node-minify.js:104:17)
at Object.compress (/usr/local/lib/node_modules/minify-all/node_modules/node-minify/lib/node-minify.js:132:27)
at Object.minify (/usr/local/lib/node_modules/minify-all/node_modules/node-minify/lib/node-minify.js:83:10)
at /usr/local/lib/node_modules/minify-all/index.js:30:13
at /usr/local/lib/node_modules/minify-all/index.js:14:13
at Array.forEach (native)
at walk (/usr/local/lib/node_modules/minify-all/index.js:10:36)
at /usr/local/lib/node_modules/minify-all/index.js:16:13
at Array.forEach (native)
at walk (/usr/local/lib/node_modules/minify-all/index.js:10:36)
I don't have to use uglify-js
, I just want to minimise js
and css
. Is there any other options?
If you really use uglify, you need to go install uglify-js
: https://www.npmjs.com/package/uglify-js instead.
npm install uglify-js -save--dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With