acorn command not found

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

Introduction

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

acorn: command not found

or when using sudo you get the following error message

sudo: acorn: command not found

Solutions to acorn: command not found

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

In Ubuntu acorn is provided by node-acorn package.

node-acorn is:

Acorn is a tiny, fast JavaScript parser written in JavaScript.

acorn.js defines the main parser interface. The library also comes with a error-tolerant parser and an abstract syntax tree walker, defined in other files.

This package contains the acorn module for Node.js.

This package contains also small pluggins packages acorn-bigint, acorn-dynamic-import, acorn-jsx, acorn-node, acorn-private-class-elements, acorn-class-fields, acorn-static-class-features, acorn-export-ns-from, acorn-numeric-separator, acorn-private-methods.

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-acorn

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

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

sudo apt -y install node-acorn

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

sudo aptitude install node-acorn

Summary

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