Installing Ember.js on managed hosting accounts
Learn how to install Ember.js on a managed hosting account with this guide. This client-side JavaScript web application framework is used to create single-page applications.
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:
-
Log in to your account using SSH.
-
At the command prompt, type the following commands:
mkdir ~/lib cd ~/lib npm install ember-cli
-
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
-
To confirm that Ember is installed and configured correctly, type the following command:
ember --version
Ember displays the version number.
Tip
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:
-
At the command prompt, type the following commands:
cd ~ ember new testProject
This creates a new Ember application named testProject.
-
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 &
Note
-
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.
-
-
Type the following command:
cd ~/public_html
-
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]
-
In both RewriteRule lines, replace xxxxx with the port you specified in step 2.
-
Save the changes to the .htaccess file, and then exit the text editor.
-
Use your web browser to visit your web site. If the Ember application is running, you see the Welcome to Ember page.
Tip
-
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
icon, click Tools, and then click JavaScript Console.
-
Microsoft Internet Explorer: Click the
icon, click F12 developer tools, and then click the Script tab.
More Information
-
To view the official Ember.js site, please visit http://emberjs.com.
-
To view the official Ember.js documentation, please visit http://emberjs.com/guides.
Related Articles
Updated 1 day ago