在 ubuntu 12.04 上安装 nodejs 和 npm 后无法找到 .npmrc 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17375499/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
cannot locate .npmrc file after installing nodejs and npm on ubuntu 12.04
提问by v09
I just followed a tutorial to install nodejs and npm on my ubuntu 12.04. https://gist.github.com/dwayne/2983873
我只是按照教程在我的 ubuntu 12.04 上安装 nodejs 和 npm。 https://gist.github.com/dwayne/2983873
now after installing both are working fine. I checked them by
现在安装后两者都工作正常。我检查了他们
node -v npm -v
节点 -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.
他们似乎给了我想要的结果。我的问题是我无法找到 .npmrc 文件。是不是很奇怪。
I want to know is it created by default when we install npm ? or should I create it myself.?
我想知道它是在我们安装 npm 时默认创建的吗?还是我应该自己创建。?
回答by user568109
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 documentationon npm configuration files.
可以有每个用户的、全局的和内置的 npmrc 配置。所以不要担心你的主目录中是否没有 .npmrc 文件。userconfig 可能存在也可能不存在。您可以查看文档的新公共管理的配置文件。
userconfig is not created for all users. To check if user config is there and its location you can do :
userconfig 不是为所有用户创建的。要检查用户配置是否存在及其位置,您可以执行以下操作:
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.
全局 npmrc 存在于安装 npm 的地方。用户有自己的。在搜索键时,userconfig 文件比全局配置具有更高的优先级。但是如果它不存在 globalconfig 使用。

