What is the reason for Yarn to generate subsequent requests while installing a particular package?

After setting up verdaccio and publishing a private package to it, I configured the yarn registry to send requests to the verdaccio proxy server. However, when making requests to the proxy server, yarn is also sending additional requests to the yarnpkg server for unrelated packages. This raises two important issues:

  1. yarn should not be making unnecessary requests for other packages that are not dependencies of the desired package.
  2. yarn should not be requesting data from the yarnpkg server when the user has explicitly set the registry.
$ yarn config get registry
http://localhost:4873/
$ yarn config list
yarn config v1.15.2
info yarn config
{ 'version-tag-prefix':
   'v',
  'version-git-tag':
   true,
  'version-commit-hooks':
   true,
  'version-git-sign':
   false,
  'version-git-message':
   'v%s',
  'init-version':
   '1.0.0',
  'init-license':
   'MIT',
  'save-prefix':
   '^',
  'bin-links':
   true,
  'ignore-scripts':
   false,
  'ignore-optional':
   false,
  registry:
   'http://localhost:4873/',
  'strict-ssl':
   true,
  'user-agent':
   'yarn/1.15.2 npm/? node/v10.15.2 linux x64',
  'cache-folder':
   '/tmp',
  lastUpdateCheck:
   1556742143802 }
info npm config
{}
Done in 0.03s.
$ yarn add @electron-e/store --verbose
yarn add v1.15.2
warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries.
... (remaining content omitted for brevity) ...
verbose 13.409 Performing "GET" request to "https://registry.yarnpkg.com/@types/react-slick/-/react-slick-0.23.3.tgz".
verbose 13.423 Error: getaddrinfo ENOTFOUND registry.yarnpkg.com registry.yarnpkg.com:443
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)
error An unexpected error occurred: "https://registry.yarnpkg.com/antd/-/antd-3.16.6.tgz: getaddrinfo ENOTFOUND registry.yarnpkg.com registry.yarnpkg.com:443".
info If you think this is a bug, please open a bug report with the information provided in "/home/devilfromir/Code/projects/desktop/NRobo/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Answer №1

When a user explicitly sets the registry, yarn should not be making requests to the yarnpkg server.

To fix the issue, I found that putting the custom registry inside .npmrc worked. It's strange, but it appears that yarn gives preference to .npmrc over .yarnrc.

echo registry={CUSTOM_REGISTRY} > ~/.npmrc

Yarn should not be making additional requests for packages that are not dependencies of the desired package.

I'm not sure why, but testing with npm shows that it also makes extra requests. Perhaps it's an internal process to ensure the cleanliness of everything within node_modules.

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

Transmit information from MATLAB to a website hosted locally

I've built a MATLAB GUI that generates numerous plots. My goal now is to display these plots on a local website through an HTML/JS file. I'm thinking of transferring the data to my browser/website using a Client/Server approach and then plottin ...

Error Message: "Oops! It looks like you are trying to access a property or method

I am in the process of developing a static website that includes tabs (a reactive property), each containing multiple cards (also a reactive property) with images and text. Recently, I encountered the following warning: [Vue warn]: Property or method &qu ...

The flow of Ajax execution halts once the initial calculation is completed

I have been developing an AJAX code that calculates fees. The code works well initially, but it stops functioning when I try to perform a second operation. <script> var weight = document.getElementById("weight").value; var ship_type = document.g ...

Error: Unable to access property 'nTr' as it is not defined

When I invoke the fnSelect function, an error occurs in Chrome: Uncaught TypeError: Cannot read property 'nTr' of undefined This is the code snippet causing the issue: $('#ToolTables_table_id_0, #ToolTables_table_id_1').mousedown(fun ...

What is the best way to extract attribute values from a CodeIgniter calendar using the Ajax success result?

I am working with the codeigniter calendar to display events. Initially, when I generate the calendar and show each event, everything works fine. Each event can be displayed in a bootstrap modal based on the day that is clicked and passed to my controller ...

Contrast 2 GET objects retrieved from separate controllers

I have 2 collections of data from different controllers. Data Collection 1 (Controller Name): [{id:1,"name":"jakov"},...] Data Collection 2 (Controller Nickname): [{id:1, "nickname" : "jandric", "nameId" :1, "title" : "master"},...] I send data from C ...

Why does the CSHTML button containing a JavaScript onclick function only function intermittently?

I've implemented a download button on a webpage that dynamically assigns an ID based on the number of questions posted. Below is the code for the button: <input data-bind="attr: { id: $index() }" type="button" value="Downlo ...

Looking to capture all page requests in Nextjs 13 with the app router?

Back in Next.js 12, I was able to use the old Pages router and write pages/[...urlParts]/index.js, which would specifically catch page routes. However, now in Next.js 13 with the new App router, my app/[...urlParts]/page.js route is capturing everything, i ...

Swapping out an entire item in a designated array index for a different object

I am faced with a JavaScript object conundrum: const myValidation = [ { id:'1', name:'qqq', field1: 'Yes', field2: 'No', field3: 'Yes' }, { id:'330', name:'www', ...

Ways to retrieve the text of the chosen radio button label with the help of jQuery

There is a radio button on my webpage that looks like this: <div id="someId"> <label class="radio-inline"> <input name="x" type="radio" onchange="GetSelectedVal();">Yes</label> <label class="radio-inline"> ...

Storing a Mongoose value as a date: best practices

Whenever I store a date in Mongoose, it always gets saved as a string. let currentDate = new Date().toISOString(); let item = await Item.findOne({}); item.details.expiryDate = currentDate; await item.save(); After checking the database ...

Having trouble sending an HTTPS request in NodeJS only to receive an HTTP response instead

As I develop my website using NodeJS and deploy it on Heroku, I encountered an issue upon opening the website. Here is the problem at hand: When looking at the main source file of my web application: app.get('/', (req, res) => { var data ...

Enhance the functionality of your Rails application by implementing Ajax or jQuery to asynchronously load table elements separately from the page

Currently, I am facing an issue with a page that displays a list of user sites. The problem lies in the fact that I am making an API call for each site to check its status, which is causing the page to load very slowly. To address this issue, I would like ...

Looking to include a cookie in the API header of a web browser opened through Python selenium?

I'm currently working with Python Selenium and I've encountered a problem that I need help with. I am executing a JavaScript script in an open web browser. result = driver.execute_script(''' return await fetch("https:/ ...

Utilizing the Filter Function to Eliminate an Element from an Array

I am a beginner in the world of React and I'm currently working on developing a simple timesheet tool where users can add tasks and save them. My tech stack includes React and Typescript. Currently, my main component has an empty array for tasks and ...

In what way does the map assign the new value in this scenario?

I have an array named this.list and the goal is to iterate over its items and assign new values to them: this.list = this.list.map(item => { if (item.id === target.id) { item.dataX = parseFloat(target.getAttribute('data-x')) item.da ...

Exploring the capabilities of Dynamic Route integration with Server Side components using Supabase in Next.js

export default async function Page({ searchParams, }: { searchParams?: { [key: string]: string | string[] | undefined }; }) { // const searchParams = useSearchParams(); const id = searchParams?.p ?? "aaa"; // default value is "1" ...

Creating a circular shape around a specific location on a map is a common task in Openlayers. Here's a

I have been attempting to create a circle based on the point/coordinate where a user clicks. While I know how to generate a point and found a function that can create a circle based on said point (similar to a buffer or range ring), it appears to only func ...

Using conditional rendering to compare the outcome of an asynchronous function within v-if condition

I have a Vue component for a sidebar with the following template: Vue.component('navigation',{ template:` <ul class="nav"> <li v-if="checkIfUserIsAdmin() == true" id="adminMenu"></li> <li id="userMenu">& ...

"Enhance your website with dynamic uploader forms and AJAX scripts - Railscast #383 shows you

I've successfully implemented the uploader functionality from Railscast #383, but I'm wondering if it's possible to dynamically add and remove the uploader link using ajax? Additionally, I'd need to include the "service" instance id wh ...