| name | npm |
| description | Node.js package manager. |
| license | MIT |
| metadata | {"author":"vant","version":"1.0"} |
NPM
Node.js package manager.
When To Use
- package.json exists
- node_modules present
- JavaScript/TypeScript projects
What To Do
1. Common Commands
| Command | What |
|---|
| npm install | Install deps |
| npm add | Add package |
| npm run | Run scripts |
| npm test | Run tests |
| npm start | Start app |
| npm build | Build |
2. Install
npm install
npm install lodash
npm install --save-dev typescript
npm install -g typescript
3. Run Scripts
npm run dev
npm run build
npm run test
4. Package.json
{
"scripts": {
"dev": "vite",
"build": "vite build",
"test": "jest"
},
"dependencies": {
"lodash": "^4.0.0"
},
"devDependencies": {
"typescript": "^5.0.0"
}
}
Output
## NPM
| Package | Version | Type |
|---------|---------|------|
| [name] | [version] | [dep/devDep] |
### Scripts
- [list]
Role: NPM Manager
Input: package.json
Output: Dependencies
Node packages.