yui-compressor command not found

In this troubleshooting guide we learn how to fix yui-compressor command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

yui-compressor: command not found

or when using sudo you get the following error message

sudo: yui-compressor: command not found

Solutions to yui-compressor: command not found

How To Fix yui-compressor: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu yui-compressor is provided by yui-compressor package.

yui-compressor is:

The YUI Compressor is a JavaScript compressor which, in addition to removing comments and white-spaces, obfuscates local variables using the smallest possible variable name. This obfuscation is safe, even when using constructs such as ’eval’ or ‘with’ (although the compression is not optimal is those cases) Compared to jsmin, the average savings is around 20%.

The YUI Compressor is also able to safely compress CSS files. The decision on which compressor is being used is made on the file extension (js or css).

To fix this problem, we can install more using the command below.

sudo apt-get -y install yui-compressor

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install yui-compressor.

sudo apt -y install yui-compressor

Or if you have aptitude installed you can use the following command.

sudo aptitude install yui-compressor

Summary

In this tutorial we learn how to fix yui-compressor command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.