npm के Basics
npm Node का package manager है: यह दूसरे लोगों का code download करता है और आपके project की dependencies track करता है।
In this page:
Syntax
npm init
npm install package_name
npm run script_name
npm Basics
npm init आपके project describe करने वाला एक package.json बनाता है। npm install <name> node_modules में एक package download करता है और इसे package.json में record करता है। npm run <script> scripts section में defined commands चलाता है।
Note:
package.json और package-lock.json commit करें, कभी node_modules नहीं।
उदाहरण: npm basics
$ npm init -y
$ npm install lodash
added 1 package in 2s
$ npm run
Scripts available in demo via `npm run-script`:
start
node index.js
⚠️ Run this in your own terminal or Node.js environment.
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- node_modules को git में commit करना
- package-lock.json हाथ से edit करना
- जब एक local package safer हो तब global packages install करना
चैप्टर सारांश
- npm init package.json बनाता है
- npm install dependencies add करता है
- npm run scripts चलाता है
- node_modules commit न करें
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: