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


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?

The definative answer is going to come from npm. This is a link to the doc: npmrc | npm Docs

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.

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!

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