# Correct position of the .npmrc file for an node-red instance

**URL:** https://discourse.nodered.org/t/correct-position-of-the-npmrc-file-for-an-node-red-instance/62694
**Category:** General
**Created:** [16 May 2022 13:35 UTC](https://discourse.nodered.org/t/correct-position-of-the-npmrc-file-for-an-node-red-instance/62694 "2022-05-16T13:35:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![NetHans](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nethans/32/2843_2.png) [@NetHans](https://discourse.nodered.org/u/NetHans)
#### Post date: [16 May 2022 13:35 UTC](https://discourse.nodered.org/t/correct-position-of-the-npmrc-file-for-an-node-red-instance/62694/1 "2022-05-16T13:35:17Z")

</div>

Hello,

I am running multiple node-red instances on a Windows PC.  
Each instance runs the same node-red installation. I have made the separation via the `settings.json` file.  
I have one node-red installation directory and multiple instance directories (`userDir` in `settings.json`).

Now I wanted to attach a local npm register per instance. Each instance needs its own access token. I wanted to insert this token into the `.npmrc` file and put the file into the `userDir`. Node-RED or npm does not use the npmrc file from the `userDir` when installing a node from my catalog. It always uses the `.npmrc` file from the user context. In my case the file `C:\Users\testuser001\.npmrc`.

Where do I put the `.npmrc` file created specifically for a node-red instance so that npm uses it when installing a node for a specific instance?

---

<div class="post-metadata">

### Author: ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)
#### Post date: [16 May 2022 18:52 UTC](https://discourse.nodered.org/t/correct-position-of-the-npmrc-file-for-an-node-red-instance/62694/2 "2022-05-16T18:52:48Z")

</div>

The definative answer is going to come from npm. This is a link to the doc: [npmrc | npm Docs](https://docs.npmjs.com/cli/v7/configuring-npm/npmrc)

That implies that it should pick up a `.npmrc` file in the `userDir` as that is where the `package.json` and `node_modules` for the nodes installed via the Manage Palette option, npm is run from the `userDir`.

---

<div class="post-metadata">

### Author: ![NetHans](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nethans/32/2843_2.png) [@NetHans](https://discourse.nodered.org/u/NetHans)
#### Post date: [18 May 2022 09:07 UTC](https://discourse.nodered.org/t/correct-position-of-the-npmrc-file-for-an-node-red-instance/62694/3 "2022-05-18T09:07:16Z")

</div>

Originally it did not work. When I put the file in the `userDir` it was not used. Only after I deleted all `.npmrc` files on the PC and created new ones, it worked. Apparently one `.npmrc` had priority over the ones in `userDir`.

Thanks for your help!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [1 June 2022 09:07 UTC](https://discourse.nodered.org/t/correct-position-of-the-npmrc-file-for-an-node-red-instance/62694/4 "2022-06-01T09:07:27Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
