Configuring Node.js
[package] has to be replaced by the name of the package to be installed.
Supported versions
| 22 |
| 20 |
| 18 |
| 16 |
| 14 |
| 12 |
| 10 |
| 8 |
| 6 |
The default version can be changed from the administration section, under Environment > Node.js. This is the version that is especially used when you start node.
Versions are not necessarily already installed.
Note
Only LTS versions are made available.
Binary to use
You need to always use node (or /usr/bin/node). nodejs does not work.
To force the use of a different version of Node.js other than the default one, define the environment variable NODEJS_VERSION:
$ NODEJS_VERSION=12 nodeIn your scripts, use /usr/bin/node as shebang:
#!/usr/bin/nodeEnvironment
Your Node.js environment starts off empty, with no ready installed libraries. You can use npm to install package:
$ npm install [package]You can also use npm in global mode, the package will be installed in the $HOME/.npm-packages directory:
$ npm install -g [package]HTTP deployment
To deploy an HTTP application with Node.js, create a Node.js type site in the Web > Sites section.

You need to specify the command that will start your Node.js application, for example:
node $HOME/myapp/index.jsWarning
Your application must absolutely listen to IP and the port shown in the site configuration in the Command field. The IP / HOST and PORT environment variables can also be used.