Why is npm fetching packages from a private registry instead of the default registry.npmjs.org?

I created a .nmprc file in the project directory with the following content:

@mycompany:registry=https://registry.mycompany.com/

However, when I run npm install, I noticed that package dependencies not starting with @mycompany are also being installed from https://registry.mycompany.com/ instead of https://registry.npmjs.org/.

This is an excerpt from my package-lock.json file:

"yaml": {
  "version": "1.7.2",
  "resolved": "https://registry.mycompany.com/yaml/-/yaml-1.7.2.tgz",
  "integrity": "sha512-qXROVp90sb83XtAoqE8bP9RwAkTTZbugRUTm5YeFCBfNRPEp2YzTeqWiz7m5OORHzEvrA/qcGS8hp/E+MMROYw==",
  "dev": true,
  "requires": {
    "@babel/runtime": "^7.6.3"
   }

Answer №1

When utilizing an .npmrc File, the npm install command will search for packages within your company's registry at https://registry.mycompany.com/

To install additional Packages, you must modify your .npmrc File as shown below.

Your Current .npmrc File:

@mycompany:registry=https://registry.mycompany.com/

Updated Version

@mycompany:registry=https://registry.mycompany.com/

registry=https://registry.npmjs.org

Running npm install will install all Packages with the @mycompany flag from your company's Registry and attempt to install all other packages from the public npm Registry.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to incorporate a placeholder within npm scripts and then dynamically replace it using the npm command?

Looking to update a specific part of an npm script without creating multiple scripts. The current script is as follows: "scripts": { "test:chrome": "set DEV_MODE=staging& npx testcafe \"chrome --start-fullscreen\" automation_suite/tests" } ...

Guide on incorporating jQuery library files into existing application code with the npm command

Recently, I used a node JS yo ko command to create a single-page application using Knockout-JS. Following that, I proceeded to install jquery packages using the command npm install jquery The installation was successful. However, my current goal is to in ...

Error: When trying to initialize, an unexpected { token was encountered

Issue: While updating my Node.js version, I inadvertently broke my Node.js program. The problem is that I can't recall the previous Node.js version that was working fine before this happened. Error: When I try to run my program using node app.js, ...

Error message: "Error on MacOS - Symbol not found: ____chkstk_darwin when executing node or npm commands"

Whenever I try to run node or npm commands on the terminal (like node -v, npm -v, or just node or npm), I encounter the following error message: dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin Referenced from: /Users/alvarez/.nvm/ve ...

Step-by-step guide on serving index.html for angularjs and other frameworks using a server

After scouring Stack Overflow and various forums without success, I finally stumbled upon a solution that worked for me. I wanted to share it here in case it helps someone else :) This solution is specifically tailored for the folder structure outlined be ...

There seems to be an issue with running the build command in next.js, resulting in an npm run

Whenever I try to execute npm run build, I encounter an error. Despite all pages functioning correctly without any errors, the problem arises when I attempt to make API calls using getServerSideProps. Error: Error: connect ECONNREFUSED 127.0.0.1:3000 ...

What are the steps to implement the `serialport` library in `deno`?

After tinkering with Deno to extract readings from an Arduino, I encountered a roadblock when it came to using the serialport library correctly. Here is what I attempted: According to a post, packages from pika.dev should work. However, when trying to use ...

Issue: Error code 0308010C encountered in the digital envelope routines, indicating unsupport for the command npm run storybook

Whenever I attempt to run npm run storybook An error pops up in the terminal: Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:133:10) Operating System - ...

Setting a unique build number in Jenkins using either yarn or npm from the command line - here's how!

I'm fairly new to the world of nodejs and I am currently working on automating the regular build of a UI application using Jenkins. I have encountered a challenge with setting the 'build number' part of the version from the command line befo ...

Cannot locate a compatible version for @babel/traverse@^7.14.0

After attempting to clone a project and running npm install, I encountered the following error: npm ERR! code ETARGET npm ERR! notarget No matching version found for @babel/traverse@^7.14.0. npm ERR! notarget In most cases you or one of your dependencies a ...

Hyperledger Fabric: ERROR! 404 - The requested fabric-chaincode-api package (version 1.4.5) could not be found on the npm registry

I created my chaincode using Node.js API and now I'm attempting to perform the instantiation process. docker image: hyperledger/fabric-peer:1.4.5 In my package.json file, here is what I have included: { "name": "democontract", "version": "1 ...

Having difficulty executing the command 'npm install -g expo-cli'

When attempting to execute npm install - g expo-cli on a Windows 10 machine, I am encountering issues. An error message keeps popping up and preventing me from proceeding. I'm in desperate need of assistance! npm WARN deprecated <a href="/cdn-cgi/ ...

When the npm command is executed, it searches for a binary file within the current

I keep encountering an issue where when I try to use npm or other binaries like rails, it triggers nodejs and displays an error message stating that node cannot locate a module. For instance, if I run npm in the homefolder, an error message pops up: Erro ...

Acquiring information from a website using Node.js

My experience with node.js is quite limited, and I am facing a challenge that seems more complex than it should be. Using the request npm module, I am trying to fetch content from a web page. The goal is to then utilize this content later in the program. H ...

Error: Unable to retrieve data from a null property when accessing MongoCR.auth in a Node.js application using the MongoDB npm package

While working with Node.js, Express, and MongoDB, I encountered a strange error. Despite my efforts to find a solution online, I haven't had any luck so far. Therefore, I am reaching out here in hopes of finding a resolution. Below is the code snippe ...

Error: Required package bootstrap-duallistbox@github:istvan-ujjmeszaros/bootstrap-duallistbox is not found

After running npm install to install packages, I encountered the following error : npm ERR! code ELOCKVERIFY npm ERR! Errors were found in your package-lock.json, run npm install to fix them. npm ERR! Missing: bootstrap-duallistbox@github:istvan-ujj ...

Nextjs couldn't locate the requested page

After creating a new Next.js application, I haven't made any changes to the code yet. However, when I try to run "npm run dev," it shows me the message "ready started server on [::]:3000, url: http://localhost:3000." But when I attempt to access it, I ...

Optimizing JavaScript performance by packaging files with Browserify

Currently, I am utilizing AngularJS for the front end of my project. Initially, I was using Grunt as my build tool but now I am interested in transitioning to npm for this purpose. I came across a useful link that discusses using npm scripts as a build too ...

Exploring the potential of npm init and harnessing the power of package.json

Recently, I started a fresh project using AngularJS. I cloned an existing project from the main branch master (master -> origin) (<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="caafb9b9afa4bea3aba6e7b8afaba9be8afae4f9e4fa"&g ...

Customizing ESLint configurations for a more productive local development environment

Let's consider an inspiring scenario: I am in the process of coding and need to troubleshoot an issue, so here is a snippet of my code: function foo() { console.log("I'm resorting to printf debugging in 2016"); } However, our build setup in ...