npm not reading .npmrc file

If what you posted is truly the output of ls -a, then the filename is wrong.

~:.npmrc should be named .npmrc.

The ~ at the beginning suggests you used a shell shortcut to place the file in your home directory (maybe something like cp .npmrc ~:.npmrc. The trouble is likely the colon. ~/ will be interpreted as "my home directory", but ~something/ will be interpreted as the home directory of the user named something. Since there is no user something, the system is probably just treated ~: as literal text.

Try renaming the file and see if that works:

mv "~:.npmrc" .npmrc

For people running Windows, check if Windows is hiding file extensions. For me, Windows was saying that the file name was .npmrc, but the real file name was .npmrc.txt.

Removing the .txt extension fixed the issue.


In my case the character encoding was wrong for some reason, I had to convert it to UTF-8.

I used "npm get" to discover the problem, the result was full of u/2411... strings.

Tags:

Macos

Node.Js

Npm