How to install Ember.js on managed hosting accounts

This article describes how to install Ember.js on a managed hosting account.

Ember.js is a client-side JavaScript web application framework used to create single-page applications. Ember.js is based on the model-view-controller (MVC) architecture and includes support for automatically updating templates, application state management, and much more.

Step 1: Install Node.js and npm

Ember.js runs on top of Node.js, so the first step is to install Node.js and npm (the Node.js package manager) on your account. For step-by-step instructions about how to do this, please see this article.

Step 2: Install Ember.js

After you install Node.js on your account, you are ready to install Ember. To do this, follow these steps:

  1. Log in to your account using SSH.
  2. At the command prompt, type the following commands:
    mkdir ~/lib
    cd ~/lib
    npm install ember-cli
  3. To create a symbolic link that enables you to run Ember from any directory in your account, type the following commands:

    cd ~/bin
    ln -s ../lib/node_modules/ember-cli/bin/ember ember
    
  4. To confirm that Ember is installed and configured correctly, type the following command:

    ember --version
    

    Ember displays the version number.

    To display Ember's online help, type the following command:

    ember help

Step 3: Create an Ember.js application

After you install Ember, you are ready to create an Ember.js application and integrate it with the web server. To do this, follow these steps:

  1. At the command prompt, type the following commands:
    cd ~
    ember new testProject
    

    This creates a new Ember application named testProject.

  2. To start the Ember application, type the following commands. Replace xxxxx with a number between 49152 and 65535 (inclusive):

    cd ~/testProject
    JOBS=1 nohup ember server --port xxxxx &
    
    • To run Ember on a shared server, you must choose an unused port between 49152 and 65535 (inclusive).
    • The & places the command in the background, and the nohup command ensures that the application continues running even if you log out of the current terminal session.
  3. Type the following command:

    cd ~/public_html
  4. In your preferred text editor, create an .htaccess file and add the following lines:

    RewriteEngine On
    RewriteRule ^$ http://127.0.0.1:xxxxx/ [P,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ http://127.0.0.1:xxxxx/$1 [P,L]
  5. In both RewriteRule lines, replace xxxxx with the port you specified in step 2.
  6. Save the changes to the .htaccess file, and then exit the text editor.
  7. Use your web browser to visit your web site. If the Ember application is running, you see the Welcome to Ember page.

    • If the Ember application fails to start, the port you chose may already be in use. Check the application log or nohup.out file for error codes that indicate the port is in use. If it is, select a different port number for your application, update the .htaccess file with the new port number, and then try again.
    • To stop a currently running Ember application, type the following command:
      pkill ember

      This command immediately stops all running Node.js applications.

Troubleshooting Ember.js-enabled pages

Because Ember.js is JavaScript-based and runs on the client, you can use a web browser to troubleshoot and diagnose problems. Many web browsers include a console that provides detailed information about the JavaScript run-time environment. This information is extremely helpful for debugging applications:

  • Mozilla Firefox: On the Tools menu, click Web Developer, and then click Web Console.
  • Google Chrome: Click the Google Chrome settings icon icon, click Tools, and then click JavaScript Console.
  • Microsoft Internet Explorer: Click the Internet Explorer settings icon icon, click F12 developer tools, and then click the Script tab.

More Information

Get Ember.js Hosting

Article Details

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.