Running code

node app.js Run a Node.js script (app.js)

Check Versions

node -v Check Node.js version
npm -v Check npm version

Initialize a Project

npm init Manually initialize package.json (prompts for project details)
npm init -y Automatically initialize package.json with default values

Install and Manage Dependencies

npm install <package> Install a package and add it to node_modules
npm install -g <package>
npm install <package> --save (Default) Install and add to dependencies
npm install <package> --save-dev Install and add to devDependencies (for development only)
npm install Install all dependencies listed in package.json
npm uninstall <package> Remove a package
npm update <package> Update a specific package
npm outdated Check for outdated dependencies

Running npm Scripts

npm run <script> Run a script defined in package.json
npm start Run the start script (npm run start)
npm test Run the test script
npm run build Run the build script