Starting In A New Company? Think Npmrc And Git Name
How to configure your company’s npm Enterprise registry and provide your name for Git interactions
--
I share one trick a day until the end of the COVID-19 quarantine in Switzerland, April 19th 2020. Twenty-six days left until hopefully better days.
Every single time I am hired to join a team as an external developer for a while, I can guarantee you that I will have to google how I can configure the company npm Enterprise registry on my laptop 🙈. Moreover, it is also pretty sure that my first commit is going to happens with my GitHub username peterpeterparker instead of my real name or any other expected IDs 😄.
Therefore see this new article as an open letter to my future self 😉.
Setting your company’s npm Enterprise registry
If the company has hired you, there is a good chance that, unfortunately, at least some of their work is only available as closed source and distributed with a npm private registry. To configure such an entry, you can run the following command line in a terminal.
npm config set registry https://registry.company.com:1234
Npmrc
If like me you are using your own laptop, you might not want to modify or mix up your private configuration with you client configuration right?
That’s why npmrc is there for us. With its help we are going to be able to define and switch between multiple npm profiles.
If you have not yet installed it, let’s first do so.
npm i npmrc -g
Once installed, we can use it to create Enterprise profile. For example, let’s create a profile called “client”.
npmrc -c client
After the profile has been created, it becomes the one in use, therefore, if we run the registry command, it will now set the registry only for the active profile.
npm config set registry https://registry.company.com:1234