Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot locate .npmrc file after installing nodejs and npm on ubuntu 12.04

I just followed a tutorial to install nodejs and npm on my ubuntu 12.04. https://gist.github.com/dwayne/2983873

now after installing both are working fine. I checked them by

node -v npm -v

They seem to give me desired result. My question is I am not able to locate .npmrc file. Is n't it weird.

I want to know is it created by default when we install npm ? or should I create it myself.?

like image 871
v09 Avatar asked Jun 29 '13 00:06

v09


People also ask

Where is my .npmrc file Ubuntu?

It is inside the home folder of the user. Different . npmrc exists for sudo user (for root inside /root) and your user (inside /home/username).

Does npm use Npmrc?

pnpm gets its configuration from the command line, environment variables, and . npmrc files.


1 Answers

There can be per-user, global and built-in npmrc configs. So don't worry about if there is no .npmrc file in your home directory. userconfig may or may not exist. You can check the documentation on npm configuration files.

userconfig is not created for all users. To check if user config is there and its location you can do :

npm config ls -l | grep config 

My output comes out as

; cli configs ; userconfig /home/ubuntu/.npmrc globalconfig = "/data/storage/node-v0.8.8-linux-x64/etc/npmrc" userconfig = "/home/ubuntu/.npmrc" 

The global npmrc exists where the npm is installed. And user's has its own. The userconfig file has higher priority over global config, when searching for keys. But if it is absent globalconfig is used.

like image 86
user568109 Avatar answered Oct 14 '22 15:10

user568109