0

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. I don't even use npm that much.

This is in my home directory:

home folder

Then inside that folder (shows 0 elements because the inside folders are hidden):

inside '~' folder

And finally inside .npm-packages folder:

inside .npm-packages folder

The last one (etc) has no elements inside.

Is this a misconfiguration of npm?, How can I correct this?

Cœur
  • 37,241
  • 25
  • 195
  • 267
pazitos10
  • 1,641
  • 16
  • 25
  • 1
    You must have set a NPM related path to something using the character `~` but the piece of software using it must **not** do the tilde expansion [0]. So it is creating the directory hierarchy for you. [0] https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html – galaux Mar 25 '16 at 17:19
  • Thank you @galaux!, I realized a week ago that in my .npmrc file I had `prefix=~/.npm-packages`, so I manually changed it to `prefix=${HOME}/.npm-packages` and it seems to be fixed now. I just forgot to update this thread. – pazitos10 Mar 26 '16 at 00:16

1 Answers1

0

Well, my problem was related to the prefix path in my .npmrc file. Its content was:

prefix=~/.npm-packages

But according to @galaux reply:

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. So the final content in my .npmrc file is:

prefix=$HOME/.npm-packages

Where $HOME produces the output: /home/my_user_name.

pazitos10
  • 1,641
  • 16
  • 25