[英]Why npm is creating a folder called '~' in my home directory?
I have this "issue", since a couple days. 几天以来,我有这个“问题”。 I've noticed that I have a folder named '~' in my home directory and don't know how to tell npm to stop doing that.
我注意到我的主目录中有一个名为“〜”的文件夹,并且不知道如何告诉npm停止这样做。 I don't even use npm that much.
我什至不使用npm。
This is in my home directory: 这在我的主目录中:
Then inside that folder (shows 0 elements because the inside folders are hidden): 然后在该文件夹内(显示0个元素,因为内部文件夹已隐藏):
And finally inside .npm-packages folder: 最后进入.npm-packages文件夹:
The last one (etc) has no elements inside. 最后一个(等)内部没有元素。
Is this a misconfiguration of npm?, How can I correct this? 这是npm的配置错误吗?如何解决?
Well, my problem was related to the prefix path in my .npmrc file. 好吧,我的问题与我的.npmrc文件中的前缀路径有关。 Its content was:
其内容为:
prefix=~/.npm-packages
But according to @galaux reply: 但是根据@galaux的回复:
the piece of software using it must not do the tilde expansion.
使用该软件的软件一定不能进行波浪号扩展。
So it was creating the whole directory hierarchy for me. 因此,它正在为我创建整个目录层次结构。
To solve it, I replaced ~
character to something similar: $HOME
. 为了解决这个问题,我将
~
字符替换为类似的东西: $HOME
。 So the final content in my .npmrc file is: 因此,我的.npmrc文件中的最终内容是:
prefix=$HOME/.npm-packages
Where $HOME
produces the output: /home/my_user_name
. $HOME
产生输出: /home/my_user_name
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.