json2module command not found

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

Introduction

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

json2module: command not found

or when using sudo you get the following error message

sudo: json2module: command not found

Solutions to json2module: command not found

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

In Ubuntu json2module is provided by node-json2module package.

node-json2module is:

For example, given a package.json file and run this through json2module, you’ll get ES6 module as output.

This is particularly useful for exporting a version number defined in your package.json file when using Rollup. Unlike rollup-plugin-json, which enables Rollup to parse JSON directly, json2module creates standard ES6 modules that can be consumed by any client.

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

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

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

sudo apt -y install node-json2module

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

sudo aptitude install node-json2module

Summary

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