Node.js

From DreamFactory
Jump to: navigation, search
(Created page with "==Info== We support writing event scripts and custom scripting service scripts running under Node.js. You must install a Node.js server on your host machine. Node version must...")
 
(Info)
Line 1: Line 1:
 
==Info==
 
==Info==
We support writing event scripts and custom scripting service scripts running under Node.js. You must install a Node.js server on your host machine. Node version must be 5.7.0 or greater. DreamFactory will call node directly to run the script. Please see our example scripts for Node.js for more information.
+
We support writing event scripts and custom scripting service scripts running under Node.js. You must install a Node.js server on your host machine. Node version must be 5.7.0 or greater. DreamFactory will call node directly to run the script.  
 +
==Modules==
 +
===Bitnami installs-Linux and Bitnami VM===
 +
This tutorial covers installing Node.js in Linux environments and on the Bitnami VM which uses Ubuntu Linux. There are several ways to install Node.js, for this tutorial we are going to use the [https://en.wikipedia.org/wiki/Wget '''wget'''] utility to download the Node ''tarball'' (compressed and archived file source) to ensure we get the most recent version of Node.js.
 +
===Linux -- Bitnami VMs===
 +
In this tutorial we will be installing '''Node-V5.8.0'''. For a list of other available versions visit the Node website [https://nodejs.org/en/ here] .
 +
<br>
 +
'''Note:''' The tutorial is still applicable when installing different versions of Node. You'll only need to adjust the versioning information in the commands to correspond with the version you wish to install. As a general rule it is recommended to install the ''stable'' version.
 +
<br>
 +
====Bitnami VM====
 +
'''Note:''' Some commands may require elevated privileges to run. If you aren't successful or the initial command displays an error try running the command using '''sudo'''.
 +
*Change directories to where you wish to install Node.js. We recommend using '''/usr/local/bin''' as it is the default path in the '''.env''' file we will be editing to enable Node.js for use within Dreamfactory:
 +
**<syntaxhighlight lang=bash>$ cd /usr/local/bin</syntaxhighlight>
 +
*From this directory we will use the '''wget''' utility to download the Node.js ''tarball'' which comes pre-installed on the Bitnami VM:
 +
**<syntaxhighlight lang=bash>$ wget http://nodejs.org/distro/v5.8.0/node-v5.8.0.tar.gz</syntaxhighlight>
 +
*Unzip the ''tarball'':
 +
**<syntaxhighlight lang=bash>$ tar -zxf node-v4.4.0.tar.gz</syntaxhighlight>
 +
*Change directories into the directory where you unzipped the contents of the file:
 +
**<syntaxhighlight lang=bash>$ cd node-v5.8.0</syntaxhighlight>
 +
'''The next few steps will compile and build the installation'''
 +
*Configure Node.js:
 +
**<syntaxhighlight lang=bash>$ ./configure</syntaxhighlight>
 +
*Make the file:
 +
**<syntaxhighlight lang=bash>$ make</syntaxhighlight>
 +
*Install the file:
 +
**<syntaxhighlight lang=bash>$ sudo make install</syntaxhighlight>
 +
'''Note:''' Use '''sudo''' to install Node.js globally
 +
*After successfully installing Node.js you will be able to use Node.js for scripting and NPM to install additional modules.
 +
====Linux====
 +
'''Note:''' Some commands may require elevated privileges to run. If you aren't successful or the initial command displays an error try running the command using '''sudo'''.
 +
*It is recommended to bring your Linux distro up to date prior to installing Node.js to ensure the libraries required to install Node.js are current. Issue the following commands:
 +
**<syntaxhighlight lang=bash>$ sudo apt-get update</syntaxhighlight>
 +
**<syntaxhighlight lang=bash>$ sudo apt-get upgrade</syntaxhighlight>
 +
**<syntaxhighlight lang=bash>$ sudo apt-get install build-essential openssl libssl-dev pkg-config</syntaxhighlight>
 +
'''Note:''' [https://www.python.org/ Python] should be installed. In the event it is not you will need to install Python before proceeding with the installation. Python versions and installation options can be found [https://www.python.org/ here]
 +
*Change directories to where you wish to install Node.js. We recommend using '''/usr/local/bin''' as it is the default path in the '''.env''' file we will be editing to enable Node.js for use within Dreamfactory:
 +
**<syntaxhighlight lang=bash>$ cd /usr/local/bin</syntaxhighlight>
 +
*From this directory we will use the '''wget''' utility to download the Node.js ''tarball'' which comes pre-installed on the Bitnami VM:
 +
**<syntaxhighlight lang=bash>$ wget http://nodejs.org/distro/v5.8.0/node-v5.8.0.tar.gz</syntaxhighlight>
 +
*Unzip the ''tarball'':
 +
**<syntaxhighlight lang=bash>$ tar -zxf node-v4.4.0.tar.gz</syntaxhighlight>
 +
*Change directories into the directory where you unzipped the contents of the file:
 +
**<syntaxhighlight lang=bash>$ cd node-v5.8.0</syntaxhighlight>
 +
'''The next few steps will compile and build the installation'''
 +
*Configure Node.js:
 +
**<syntaxhighlight lang=bash>$ ./configure</syntaxhighlight>
 +
*Make the file:
 +
**<syntaxhighlight lang=bash>$ make</syntaxhighlight>
 +
*Install the file:
 +
**<syntaxhighlight lang=bash>$ sudo make install</syntaxhighlight>
 +
'''Note:''' Use '''sudo''' to install Node.js globally
 +
*After successfully installing Node.js you will be able to use Node.js for scripting and NPM to install additional modules.

Revision as of 19:16, 15 March 2016

Info

We support writing event scripts and custom scripting service scripts running under Node.js. You must install a Node.js server on your host machine. Node version must be 5.7.0 or greater. DreamFactory will call node directly to run the script.

Modules

Bitnami installs-Linux and Bitnami VM

This tutorial covers installing Node.js in Linux environments and on the Bitnami VM which uses Ubuntu Linux. There are several ways to install Node.js, for this tutorial we are going to use the wget utility to download the Node tarball (compressed and archived file source) to ensure we get the most recent version of Node.js.

Linux -- Bitnami VMs

In this tutorial we will be installing Node-V5.8.0. For a list of other available versions visit the Node website here .
Note: The tutorial is still applicable when installing different versions of Node. You'll only need to adjust the versioning information in the commands to correspond with the version you wish to install. As a general rule it is recommended to install the stable version.

Bitnami VM

Note: Some commands may require elevated privileges to run. If you aren't successful or the initial command displays an error try running the command using sudo.

  • Change directories to where you wish to install Node.js. We recommend using /usr/local/bin as it is the default path in the .env file we will be editing to enable Node.js for use within Dreamfactory:
    • $ cd /usr/local/bin
  • From this directory we will use the wget utility to download the Node.js tarball which comes pre-installed on the Bitnami VM:
    • $ wget http://nodejs.org/distro/v5.8.0/node-v5.8.0.tar.gz
  • Unzip the tarball:
    • $ tar -zxf node-v4.4.0.tar.gz
  • Change directories into the directory where you unzipped the contents of the file:
    • $ cd node-v5.8.0

The next few steps will compile and build the installation

  • Configure Node.js:
    • $ ./configure
  • Make the file:
    • $ make
  • Install the file:
    • $ sudo make install

Note: Use sudo to install Node.js globally

  • After successfully installing Node.js you will be able to use Node.js for scripting and NPM to install additional modules.

Linux

Note: Some commands may require elevated privileges to run. If you aren't successful or the initial command displays an error try running the command using sudo.

  • It is recommended to bring your Linux distro up to date prior to installing Node.js to ensure the libraries required to install Node.js are current. Issue the following commands:
    • $ sudo apt-get update
    • $ sudo apt-get upgrade
    • $ sudo apt-get install build-essential openssl libssl-dev pkg-config

Note: Python should be installed. In the event it is not you will need to install Python before proceeding with the installation. Python versions and installation options can be found here

  • Change directories to where you wish to install Node.js. We recommend using /usr/local/bin as it is the default path in the .env file we will be editing to enable Node.js for use within Dreamfactory:
    • $ cd /usr/local/bin
  • From this directory we will use the wget utility to download the Node.js tarball which comes pre-installed on the Bitnami VM:
    • $ wget http://nodejs.org/distro/v5.8.0/node-v5.8.0.tar.gz
  • Unzip the tarball:
    • $ tar -zxf node-v4.4.0.tar.gz
  • Change directories into the directory where you unzipped the contents of the file:
    • $ cd node-v5.8.0

The next few steps will compile and build the installation

  • Configure Node.js:
    • $ ./configure
  • Make the file:
    • $ make
  • Install the file:
    • $ sudo make install

Note: Use sudo to install Node.js globally

  • After successfully installing Node.js you will be able to use Node.js for scripting and NPM to install additional modules.