es6

08. Package NPM πŸ‘©β€πŸŽ“πŸ‘¨β€πŸŽ“

πŸ“– Initialize Projects Using Node Package Manager (npm)

Implement the following user story:

  • As a developer, I want to be able to keep track of dependencies using npm.

  • As a developer, I want to initialize my project and create a package.json file.

  • As a developer, I want to be able to save packages to my project.

Acceptance Criteria

  • It’s done when I see the package.json file created in a folder.

  • It’s done when I have installed the inquirer package successfully and see it listed in the package.json file.

  • It’s done when I see the node_modules folder and package-lock.json file in the folder.

πŸ“ Notes

Refer to the documentation:

πŸ’‘ Hint

It’s possible that the node_modules folder is hidden in the files.exclude setting in VS Code, so don’t let that throw you off if you don’t see it.

πŸ† BONUS

If you have completed this activity, work through the following challenge to further your knowledge:

  • How does the -y flag save us some time when running npm init? What does the -g flag do when running npm install?

Use Google or another search engine to research this.


package.json

{
  "name": "solved",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "inquirer": "^7.3.3"
  }
}