Install NPM & NodeJS
Choose a folder where you want to start your NodeJS project. Then, open the terminal and go to the folder where you want the NodeJs project. Then type “
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See npm help json for definitive documentation on these fields
and exactly what they do.
Use npm install <pkg> afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (statemag)
version: (1.0.0)
description: State management
entry point: (index.js)
test command:
git repository:
keywords:
author: Me
license: (ISC)
About to write to /Users/jojo/js/statemag/package.json:
{
"name": "statemag",
"version": "1.0.0",
"description": "State management",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Me",
"license": "ISC"
}
Is this OK? (yes)
Now, open a text editor or code editor and name your file index.js. You are ready to create your nodeJS project.