NPM (Node Package Manager) kya hai? Explained in simple Hindi
NPM (Node Package Manager) ek package manager hai jo JavaScript programming language ke liye use hota hai, khaaskar Node.js environment mein. Iska primary function hai ki yeh third-party libraries ya modules ko manage karta hai jo tumhare project mein use hote hain.
NPM ke Basic Functions:
1. Package Installation: NPM tumhe easily third-party libraries ya modules ko install karne ki facility deta hai. Yeh modules ya packages tumhare project ke `node_modules` folder mein store hote hain.
- Example: `npm install express` yeh command `express` library ko install karegi.
2. Dependency Management: Agar tumhare project mein multiple packages ki zaroorat hai, toh NPM un sab ko manage karta hai aur ensure karta hai ki correct versions install ho.
- NPM ek `package.json` file create karta hai jisme tumhare project ke saare dependencies ka record hota hai.
3. Scripts Management: NPM tumhe custom scripts define karne ki facility deta hai jo tum apne project ke liye automate karna chahte ho, jaise ki build, test, aur deploy tasks.
- Example: `npm run build` yeh command tumhare `package.json` file mein defined build script ko run karegi.
4. Package Publishing: Agar tumne khud ka JavaScript library ya tool develop kiya hai, toh tum usse NPM registry par publish kar sakte ho taaki doosre log bhi use kar sakein.
NPM kaise Use Karte Hain?
- Install karne ke liye: `npm install <package-name>`
- Global install karne ke liye: `npm install -g <package-name>`
- Naya project initialize karne ke liye: `npm init`
- Kisi script ko run karne ke liye: `npm run <script-name>`
NPM JavaScript aur Node.js developers ke liye ek powerful tool hai, jo unhe easily code share karne aur reuse karne mein madad karta hai.