Node.js

From DreamFactory
Jump to: navigation, search
(Node)
Line 3: Line 3:
 
#* <source lang=bash>$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -</source>
 
#* <source lang=bash>$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -</source>
 
# Install with Apt
 
# Install with Apt
#* <source lang=bash>$ sudo apt-get install -y nodejs</source>
+
#* <source lang=bash>$ sudo apt-get install nodejs</source>
 
# Configure DreamFactory to use Node
 
# Configure DreamFactory to use Node
 
#* <source lang="bash">$ cd /opt/dreamfactory</source>
 
#* <source lang="bash">$ cd /opt/dreamfactory</source>
Line 16: Line 16:
 
#* Apache
 
#* Apache
 
#** <source lang="bash">$ sudo  service apache2 restart</source>
 
#** <source lang="bash">$ sudo  service apache2 restart</source>
 
  
 
=== Node Modules ===
 
=== Node Modules ===

Revision as of 19:55, 11 November 2016

Node

  1. Get deb installer
    • $ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
  2. Install with Apt
    • $ sudo apt-get install nodejs
  3. Configure DreamFactory to use Node
    • $ cd /opt/dreamfactory
    • $ nano .env
      • Locate the line that reads ##DF_NODEJS_PATH=/usr/local/bin/node
      • Change it to read DF_NODEJS_PATH=/usr/bin/node
      • Save and exit the file
    • $ php artisan cache:clear
  4. Restart the PHP-FPM and Nginx or Restart Apache (whichever solution you're using.)
    • Nginx
      • $ sudo service php7.0-fpm restart && sudo service nginx restart
    • Apache
      • $ sudo  service apache2 restart

Node Modules

Node modules need to be installed in the DreamFactory installation directory. For example to install lodash (used in most DF Node tutorials):

  1. Navigate to the install directory
    • $ cd /opt/dreamfactory
  2. Install the module with NPM
    • $ npm install lodash