Setting Up your Node.js Development Environment

Set up a Node.js development environment to test your application locally prior to
deploying
it to AWS Elastic Beanstalk. This topic outlines development environment setup steps
and links to
installation pages for useful tools.

Installing Node.js

Install Node.js to run Node.js applications locally. If you don't have a preference,
get the latest version supported by Elastic Beanstalk. See Node.js in the AWS Elastic Beanstalk Platforms document
for a list of supported versions.

When support for the version of Node.js that you are using is removed from the platform
configuration, you must change or remove the version setting prior to doing a
platform upgrade. This may occur when a
security vulnerability is identified for one or more versions of Node.js

When this occurs, attempting to upgrade to
a new version of the platform that does not support the configured NodeVersion fails. To avoid needing to create a new
environment, change the NodeVersion configuration option to a version that is
supported by both the old configuration version and the new one, or
remove the option setting,
and then perform the platform upgrade.

Installing npm

Node.js uses the npm package manager to helps you install tools and frameworks for
use in your application.
Download npm at npmjs.com.

Installing the AWS SDK for Node.js

If you need to manage AWS resources from within your application, install the AWS
SDK for
JavaScript in Node.js. Install the SDK with npm:

Installing Express

Install Express globally so that you have access to the express
command.

~/node-express$ npm install -g express-generator

Depending on your operating system, you may need to set your path to run the
express command. If you need to set your path, use the output from the
previous step when you installed Express. The following is an example.

~/node-express$ export PATH=$PATH:/usr/local/share/npm/bin/express

Run the express command. This generates
package.json.

~/node-express$ express

When prompted if you want to continue, type y.

Set up local dependencies.

~/node-express$ npm install

Verify it works.

~/node-express$ npm start

You should see output similar to the following:

> nodejs@0.0.0 start /home/local/user/node-express
> node ./bin/www

Press Ctrl+C to stop the server.

Installing Geddy

Geddy is another web application framework that runs on Node.js.

To set up your Geddy development environment on your local computer

Install Geddy globally so that you have geddy generators or start the
server.

~/node-geddy$ npm install -g geddy

Depending on your operating system, you may need to set your path to run the
geddycode> command. If you need to set your path, use the output from the
previous step when you installed Geddy. The following is an example.

~/node-geddy$ export:PATH=$PATH:/usr/local/share/npm/bin/geddy

Create the directory for your application.

~/node-geddy$ geddy app myapp
~/node-geddy$ cd myapp

Start the server. Verify everything is working, and then stop the server.

~/node-geddy/myapp$ geddy
~/node-geddy/myapp$ curl localhost:4000

Press Ctrl+C to stop the server.

Javascript is disabled or is unavailable in your browser.

To use the AWS Documentation, Javascript must be enabled. Please refer to your browser's
Help pages for instructions.