How can I add a .npmrc file?

I installed node on my Mac OS Sierra. I use Windows in my work, so I have a .npmrc file in the node folder, but I don't seem to find this on mac. The problem is that I want to add a format registry

" scope=rohit-project@rohit-aquila :registry=https://registry.npmjs.org/ //registry.npmjs.org/:_authToken=03408522-4rfca-dff4f-dfsf-43863gfe3492" 

How to add it so that I can install dependencies and modules for my project by installing npm on MAC OS Sierra.

I created the .npmrc file simply and added the above code ... and npm install works there. I get the following error.

  rohitsrivastava$ npm install npm ERR! Darwin 16.4.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v7.7.3 npm ERR! npm v4.1.2 npm ERR! code E404 npm ERR! 404 Not found : @rohit-project/notes npm ERR! 404 npm ERR! 404 '@rohit-project/notes' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 It was specified as a dependency of '@rohit-project/mega' npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. 
+30
source share
1 answer

There are several different points here:

  1. Where is the .npmrc file .npmrc ?
  2. How can you download private packages

Running npm config ls -l will show you all the implicit settings for npm, including what it considers the right place to install .npmrc . But if you have never logged in (using npm login ), it will be empty. Just log in to create it.

Another thing # 2. You can do this by placing the .npmrc file in the root of the NPM package. It will then be used by NPM for authentication. It also supports interpolating variables from your shell so you can do something like this:

 ; Get the auth token to use for fetching private packages from our private scope ; see http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules ; and also https://docs.npmjs.com/files/npmrc //registry.npmjs.org/:_authToken=${NPM_TOKEN} 

pointers

+45
source

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


All Articles