browserslist command not found

In this troubleshooting guide we learn how to fix browserslist command not found error message

Introduction

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

browserslist: command not found

or when using sudo you get the following error message

sudo: browserslist: command not found

Solutions to browserslist: command not found

How To Fix browserslist: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu browserslist is provided by node-browserslist package.

node-browserslist is:

This module can be used to share browsers list between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset.

Developers set browsers list in queries like ’last 2 version’ to be free from updating browser versions manually. Browserslist will use ‘Can I Use’ data for this queries.

Node.js is an event-based server-side JavaScript engine.

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

sudo apt-get -y install node-browserslist

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

You can also use apt command to install node-browserslist.

sudo apt -y install node-browserslist

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

sudo aptitude install node-browserslist

Summary

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