Node Setup - lindell/JsBarcode GitHub Wiki

Step 1. Install the node-canvas dependencies

JsBarcode for Node.js is dependent on node-canvas to work. It does have some dependencies outside of npm to work. Make sure to install them by following the instructions in their readme.

Step 2. Install JsBarcode and node-canvas

npm install canvas
npm install jsbarcode

Step 3. Use it!

const JsBarcode = require('jsbarcode');
const { Canvas } = require("canvas");

const canvas = new Canvas();
JsBarcode(canvas, "Hello");

// Do what you want with the canvas
// See https://github.com/Automattic/node-canvas for more information