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

让人想犯罪 __ 提交于 2019-12-03 12:13:06

问题


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.?


回答1:


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.



来源:https://stackoverflow.com/questions/17375499/cannot-locate-npmrc-file-after-installing-nodejs-and-npm-on-ubuntu-12-04

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!