← Back to Node.js Course | Chapter 3: npm & Packages | Lesson 7 of 7

.npmrc फाइल

.npmrc एक छोटी config file है जो बदलती है कि npm कैसे behave करता है, जैसे registry या auth tokens।

In this page:

  1. .npmrc
Syntax
javascript
registry=https://registry.example.com/
save-exact=true
fund=false

.npmrc

npm project से, आपकी home directory से, और globally .npmrc पढ़ता है, project file priority लेते हुए। Common settings में registry, save-exact, और scoped registries शामिल हैं।

auth tokens वाली files कभी commit न करें; इनकी बजाय इनमें environment variables इस्तेमाल करें।

Note: .npmrc में ${NPM_TOKEN} placeholders इस्तेमाल करें और CI में variable set करें।

उदाहरण: .npmrc

bash
# .npmrc
registry=https://registry.npmjs.org/
save-exact=true
@mycompany:registry=https://npm.mycompany.com/
//npm.mycompany.com/:_authToken=${NPM_TOKEN}

⚠️ 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. #}
आम गलतियां
  1. auth tokens commit करना
  2. global file edit करना जब एक project वाली intended हो
  3. scope-specific registries भूल जाना
चैप्टर सारांश
  • .npmrc npm configure करता है
  • Project file user file को override करता है
  • tokens env variables में store करें
  • Scopes private registries की ओर point कर सकते हैं
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.