Installing NodeJS

The Curvenote Command Line Interface (CLI) is built on NodeJS (nodejs), a Javascript runtime that is widely used in many projects including well-known Python projects such as Jupyter Lab. node comes with its own package manager called npm.

There are a number of ways to install nodejs and you can choose one that is suitable depending on your platform and preferences.

Following any of the install methods below, verify your installation and ensure that node and npm are available on your system PATH by opening a new terminal window or command line prompt and typing:

% node -v
v18.18.2
% npm -v
v9.8.1

Manual Installation (all platforms)ยถ

You can download an appropriate installer package for your platform by visiting https://nodejs.org/. LTS refers to the current Long Term Support version of nodejs and is the best choice for use with Curvenote.

Download the installer package, and follow instructions to execute the installer for your platform. The installer will automatically add node and npm to your system PATH.

๐Ÿ› ๏ธ Next, up Installing Curvenote

node via conda / mamba (all platforms)ยถ

nodejs is available as a package on conda-forge, although a limited number of versions are available on that channel. If you are a conda user, installation is straightforward but please note that curvenote requires even-numbered node versions, and odd-numbered releases can be found on conda-forge.

๐Ÿ› ๏ธ Use the following command can be used to lock down the version you are installing, adjust as necessary for the even-numbered version you are targeting:

(my-conda-env)% conda install -c conda-forge 'nodejs>=18,<19'
(my-conda-env)% node -v
(my-conda-env)% v16.14.2
(my-conda-env)% npm -v
(my-conda-env)% v

๐Ÿ’ก Alternatively, you can create a new conda environment directly as a node environment:

% conda create -yn my-node-env 'nodejs>=18,<19'
% ....
#
# To activate this environment, use
#
#     $ conda activate my-node-env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

๐Ÿ› ๏ธ Next, up Installing Curvenote

nodeenv via pip (all platforms)ยถ

nodeenv is a python package allowing you to create and manage node installations on your system via virtual environments. If you want to work in virtual environments for node alongside your python virtualenv this is the way to go.

๐Ÿ› ๏ธ Install nodeenv:

% pip install nodeenv

๐Ÿ› ๏ธ Query available node versions:

% nodeenv --list
% ... 16.15.0 ...

๐Ÿ› ๏ธ Create a new environment based on a specific node version, and activate it:

% nodeenv -n 16.15.0 node_env
% . node_env/bin/activate
(node_env) % node -v
(node_env) % v16.15.0
(node_env) % npm -v
(node_env) % v8.5.5

Read more about nodeenv in their docs.

๐Ÿ› ๏ธ Next, up Installing Curvenote

Node Version Manager - Linux/MacOS (nvm)ยถ

nvm is a convenient way to manage multiple node installations on a POSIX compatible system.

๐Ÿ› ๏ธ Install nvm using the install script in their docs.

% nvm -v
0.39.1

๐Ÿ’ก Note: on MacOS you can also install nvm via brew

๐Ÿ› ๏ธ Next, install an initial (default) version of node:

% nvm install 18
Downloading and installing node v18...
...
Now using node v18 (npm v9)
%

๐Ÿ› ๏ธ Next, up Installing Curvenote