NPM setup

How to set up a Lisk Core node with NPM.

Pre-installation

Requirements

Supported Platforms
  • Ubuntu 18.04 (LTS) x86_64

  • Ubuntu 20.04 (LTS) x86_64

  • MacOS x86_64

Node.js
  • 12.22.7 (NPM version 6.14.15)

Node.js & NPM

Node.js serves as the underlying engine for code execution.

The correct version for NPM(6) is installed automatically with version 12 of Node.js.
  • Option A - Node version manager

  • Option B - Node.js package

It is recommended to use a Node version manager such as NVM. NVM is a bash script that enables the management of multiple active Node.js versions.

  1. Install NVM and follow the official instructions here.

  2. Install the latest LTS version of Node.js using NVM with the following command shown below:

nvm install 12.22.7

If NVM or other package managers are not required, it is possible to install the Node package globally as shown in the following commands below:

Ubuntu

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

MacOS

For MacOS, please execute the following command below:

brew install node@12.22.7

Installation

Install Lisk Core with NPM:

npm install --global lisk-core

Location

Lisk Core will be installed under installation path of NPM.

To check the location where Lisk Core was installed, execute:

npm list --global --depth=0

Start

After successful installation, start the node with the following command:

  • Mainnet

  • Testnet

lisk-core start --network mainnet
lisk-core start --network testnet

Post-installation (optional)

Use pm2 to run Lisk Core in the background

It is recommended to use a process manager like PM2 to run Lisk Core in the background.

Check the guide Process management with pm2 for more information.

Log rotation

It is recommended to set up a log rotation, because the log of Lisk Core files can grow very big over time.

Check the guide Managing logs in the SDK docs for more information.