Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Use npm init To Create New Node Projects

Adding a `package.json` file to a directory turns it into a node project. You can do this manually, or use `npm init`. For example:

Code

mkdir new_project_name
  cd new_project_name
  npm init

You'll be asked a series of questions to configure the setup. I usually just hit enter for all of them. The process produces a `package.json` file based on your answers.

To get something that runs, make an `index.js` file with something like:

Code

#!/usr/bin/env node

  console.log('here')

From there, use `npm i` to install modules. For example, install puppeteer with:

Code

npm i puppeteer

Probably a good idea to do an

Code

git init

And then push in the .gitignore and all that jazz.