FAQ - Mod 6
Welcome to the frequently asked questions page for Module 6. As many common questions can come up on Piazza, some of those questions are consolidated here.
Contents
Setup/Logistics
Should I use a database for Module 6?
You can store everything locally in this module. No need to use a database.
How can I add an image to my instance? SFTP isn't working
There are a couple different ways to load an image onto your instance. One of the easiest is to use wget. When logged into your instance, run the following command in the terminal:
$ wget <imageurl>
Running this command will download the image straight onto your instance!
Port 3456
What rule should I define for Custom TCP when setting up port 3456?
When setting up the Custom TCP rule for port 3456, it's fine to use the default source of 0.0.0.0/0. The rule will look like this:
Custom TCP 3456 Custom 0.0.0.0/0
How do I access my instance at port 3456?
All you have to do is append :3456 to the end of your instance url. Thus, the link would just be http://ec2-xx-xxx-xx-xxx.us-east-2.compute.amazonaws.com:3456/filepath
NPM/Mime
There are a couple common errors that students run into when setting up their Node.js. One of the most common looks like this
ENOENT: no such file or directory, open 'home/rlav/package.json'
The specific path may differ for your personal machine, but any path that ends in "package.json" in this error is likely a result of the same problem.
This is another common error message:
Cannot find module 'mime' error when running static_server.js
Both of these errors are a result of not setting up the package.json correctly. In fact, both are usually a result of not creating package.json at. After installing Node.js, you must run the following command to generate the package.json file.
$ npm init
After generating the package.json file, you must write the correct dependencies. Details on this are specified at the Node.JS page. If you follow everything on this page correctly, you should be able to set up Node.js rather smoothly.