Configure your environment for working with NodeJS

1 de noviembre, 2015 @ 13:27 — 0 comentarios

This guide explain a few things you need to take into account in order to work with NodeJS applications.

NodeJS executable location and your PATH

When you define a NodeJS application from the Hosting Panel your account's PATH environment variable is automatically updated to include the location of the selected NodeJS version executables.

Anyway, the above operation could fail or you may want to have your PATH correctly configured before anything else. Therefore, to configure your PATH correctly you should follow theses steps:

The .bashrc file is located in the home directory of your hosting account. Just open it:

nano .bashrc

And you will see something like:

PATH=$HOME/ruby/gems/bin:/opt/php5.3/bin:/opt/ruby/bin:$PATH:$HOME/bin
export PATH

In order to add NodeJS 0.10 to your PATH you should add /opt/nodejs-0.10/bin to it:

PATH=$HOME/ruby/gems/bin:/opt/php5.3/bin:/opt/ruby/bin:/opt/nodejs-0.10/bin:$PATH:$HOME/bin
export PATH

To use NodeJS 0.12 add /opt/nodejs-0.12/bin to your PATH:

PATH=$HOME/ruby/gems/bin:/opt/php5.3/bin:/opt/ruby/bin:/opt/nodejs-0.12/bin:$PATH:$HOME/bin
export PATH

SSH access

In order to deploy a NodeJS application or manage NPM packages you must have SSH access. Just follow the How to access your hosting via SSH guide.

Access to compilers

Many NPM packages require compilation so you should enable access to compilers before installing new NPM packages.

Etiquetas: