Check your Nodes?
Tags: node, beginners, npm, codenewbie
Published: 2018-11-30 23:18:08

---
cover_image: https://www.parkmycloud.com/wp-content/uploads/2017/05/instance-management-tool-checklist.jpg
title: Check your Nodes?
published: true
description: A quick reference guide to setting up a node project. 
tags: #node #beginners #npm #codenewbie
---
**Node.js** is an open-source, cross-platform JavaScript runtime environment designed to let JavaScript run outside of the browser or webpage.  It’s a general utility that can be used for a variety of purposes including asset compilation, scripting, monitoring, creating desktop applications, and most notably as the basis for web servers.  JavaScript can be used for the server side since Node reuses JavaScript.  This means a front-end developer can build an entire server themselves.  Other benefits of node:

- Numerous plugins are available which easily expands its capabilities. 
- Creating an entire working server can be accomplished with few lines of code which allows for faster implementations. 
- The single-threaded asynchronous model allows handling of multiples requests simultaneously without bottlenecks or slowed performance. 

**SETTING UP A NODE PROJECT**
*QUICK REFERENCE GUIDE*

- Open Favorite Code Editor
- Open Command Line within Code Editor
```javascript
`mkdir <projectName>`
`cd <projectName>`
```
- Install the Node Packages in the root directory of the project folder using the following command: 
```javascript
`npm init`
```
This step will initialize the folder and create the `package.json` file. 
- Once the installation has completed the program will prompt a series of questions to gather contextual information about the project such the project name , copyright, version, description, entry point file name, author, etc. 
- Completion of the fields is not required and can be skipped by using the `enter` key.
- When prompted with `Is this okay? (yes)` respond by entering `yes` followed by the `enter` key. 

- Look inside the <projectName> folder for the `package.json` file.
- Open the file to review and familiarize contents.
- The syntax of the JSON folder is a JavaScript object. 

- Next, run the following command in the same directory of the root folder:
```javascript
`npm install express`
``` 
This will create the `node_modules` subfolder.
- The `node_modules` file holds all the modules for the particular project.

- Go back and look inside the `package.json` file
    * A new object will appear, `dependencies`, which should have `Express` listed.
    * Any new dependencies will be added to the `package.json` file. 


**Steps to Take for Existing Projects:**
When working on an existing project that already contains a `package.json` file run the following command:
```javascript
`npm install`
```
This will evaluate the contents of the `package.json` file and install additional packages if needed. 

**Steps to Take when Receiving an Existing Project:**
```javascript
`npm install`
```
This will evaluate the contents of the `package.json` file and install additional packages if needed. 

__Do NOT Share the Node Modules Folder__

This is a critical step to remember especially when collaborating on projects.  
- Node Module folders must __NOT__ be shared, ever.  
- When the `npm install` command runs it compiles files based on the needs of the specific computer.  
- When collaborating or sharing project files, other contributors will need to install the command `npm install` in the root directory of the project folder on THEIR computer. 
- Remember the `npm install` command without a package name evaluates the existing dependencies within the `package.json` file and installs needed dependencies. 

With so many little steps to remember when building a full stack application I hope this guide becomes a helpful tool for others too.