Npm does not read .npmrc file

I am trying to install the library from a private repository and I keep getting an error when trying to use npm.

I use: OSX Mavericks 10.9.3 Node v0.10.28 npm 1.4.10 (this was installed after trying with 1.4.13 and it still doesn't work)

I run this from my home directory, and the ~/.npmrc is in the directory.

whenever i run the command: npm install 'library name here'

I get the following error:

 npm http GET https://registry.npmjs.org/dslib-js npm http 404 https://registry.npmjs.org/dslib-js npm ERR! 404 404 Not Found: dslib-js npm ERR! 404 npm ERR! 404 'dslib-js' is not in the npm registry. npm ERR! 404 You should bug the author to publish it npm ERR! 404 npm ERR! 404 Maybe try 'npm search dslib' npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, or http url, or git url. npm ERR! System Darwin 13.2.0 npm ERR! command "node" "/usr/local/bin/npm" "install" "dslib-js" npm ERR! cwd /Users/marcos.pedreiro npm ERR! node -v v0.10.28 npm ERR! npm -v 1.4.10 npm ERR! code E404 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/marcos.pedreiro/npm-debug.log npm ERR! not ok code 0 

Changes:

When I run ls -a (in the home directory), this is the result:

 . .ssh Music .. .subversion Pictures .CFUserTextEncoding .vagrant.d Public .DS_Store Applications VirtualBox VMs .Trash Desktop clients .bash_history Documents dev .gradle Downloads npm-debug.log .matlab Google Drive ~:.npmrc .npm Library ~:.npmrc.template .npmrc.bak Movies 

This is the result of the npm config ls -l | grep config npm config ls -l | grep config

 ; cli configs globalconfig = "/usr/local/etc/npmrc" userconfig = "/Users/marcos.pedreiro/.npmrc" 

: End Edits

Any help would be greatly appreciated. Thanks!

+6
source share
6 answers

If you actually published the output of ls -a , then the file name is incorrect.

~:.npmrc should be called .npmrc .

cp .npmrc ~:.npmrc , suppose you used a shell shortcut to place the file in your home directory (perhaps something like cp .npmrc ~:.npmrc ). Probably a colon problem. ~/ will be interpreted as "my home directory", but ~something/ will be interpreted as the user's home directory named something . Since there is no user something , the system is probably just handling ~: as a literal.

Try renaming the file and see if this works:

 mv "~:.npmrc" .npmrc 
+4
source

In case this helps someone to land here: I had the npm-shrinkwrap.json in the root of the project that overrided the registry configuration from .npmrc . Removing the shrinkwrap file solved the problem.

+3
source

For Windows users, check if Windows hides file extensions. For me, Windows said the file name was .npmrc , but the real file name was .npmrc.txt .

Removing the .txt extension .txt problem.

+1
source

I assume that the Node dslib-js package is contained in your private npm repository. You will need to install this repository in the local .npmrc file. For example, if your repository was located at http://myrepo.com:4000 : http://myrepo.com:4000 , you would run the following command:

 $ npm set registry "http://myrepo.com:4000" 

The error received above is that the dslib-js package is not available on npmjs.org, as you can see from a visit to this URL: https://www.npmjs.org/package/dslib-js . By default (without the registry in your .npmrc file), npm will search for https://registry.npmjs.org (which can be viewed on the Internet via the URL pasted above).

0
source

In case this helps someone ... my problem: I created the .npmrc file in a text editor, so npm ignored the file due to permissions on it. To fix this, I deleted the file. Then I redo the file through the command line.

Hooray!

0
source

I missed a couple of things to download my packages published in my personal repository.

First .npmrc.txt file .npmrc.txt instead of .npmrc . On Windows, you cannot directly create a file name. So, I opened the command line and then fired

 echo "auth_token" > .npmrc 

Second I just pasted my auth_token file into .npmrc . You must also add a registry address.

 //**.**.visualstudio.com/_packaging/**/npm/registry/:_authToken=token_here 
0
source

Source: https://habr.com/ru/post/969929/


All Articles