Back

npm and packages

npm is Node's package manager. It installs libraries other people wrote and tracks them in package.json. dependencies are needed to run the app; devDependencies are only needed while developing (like testing tools). Never commit node_modules.

npm init -y                # create package.json
npm install express        # add a dependency
npm install -D vitest      # add a dev dependency
npm uninstall express      # remove a package
npm install                # install everything in package.json

// package.json scripts
"scripts": {
  "dev": "next dev",
  "test": "vitest"
}

npm run dev

Roadmap