Overview
Npm manages JavaScript packages from the npm registry.
Why It Matters
Npm is the package manager for JavaScript and Node.js ecosystem.
Essential Commands
npm init -yCreate package.json with defaults
npm installInstall dependencies from package-lock/package.json
npm install <package>Add dependency to project
npm install -D <package>Add development dependency
npm run devRun development script
npm run buildRun production build script
Quick Start
Begin by learning install, update, and remove packages
Key Concepts
Install, update, and remove packages
Manage dependencies and devDependencies
Create and publish npm packages
Pro Tips
- Combine multiple commands for powerful workflows
- Use aliases to speed up your command entry
- Create scripts to automate repetitive tasks
Common Pitfalls to Avoid
- • Forgetting to check the documentation for edge cases
- • Running commands without understanding their full impact
- • Not testing changes in a safe environment first