What is the best way to upgrade to a specific version of a child dependency within a module?

npm version: 7.24.2

Looking for assistance on updating a child dependency. The dependency in question is:

  • vue-tel-input

This dependency relies on libphonenumber-js with version ^1.9.6

I am aiming to update libphonenumber-js to version ^1.10.12. I have already attempted the following solutions:

Any suggestions or ideas on how to achieve this?

Answer №1

It seems like achieving that task may not be straightforward given your current configuration.

You have two options: either upgrade to npm v8.3 or later, which supports overrides, or utilize yarn with resolutions.

For more information:

Overrides (npm): https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides

package.json

  "overrides": {
    "vue-tel-input": {
      "libphonenumber-js": "^1.10.12"
    }
  }

Resolutions (yarn):

package.json

  "resolutions": {
    "libphonenumber-js": "^1.10.12"
  }

Alternatively, you can manually handle the package-lock.json file to specify the version.

"vue-tel-input": {
  "version": "5.11.0",
  "resolved": "https://registry.npmjs.org/vue-tel-input/-/vue-tel-input-5.11.0.tgz",
  "integrity": "sha512-kw13LdbnSH+Zk5Qb06vflG7Abu6QsM1cQyKvTA9T4kaZeARvyvKo9YZmziy7WiSuar932DWRjGI0SJnban4a2A==",
  "requires": {
    "core-js": "^3.14.0",
    "libphonenumber-js": "^1.9.6",
    "vue": "^2.6.14"
  }
},

You could try changing

"libphonenumber-js": "^1.9.6"
to use ^1.10.12

However, it's worth noting that upon my initial installation, it did install 1.10.12

"node_modules/libphonenumber-js": {
  "version": "1.10.12",
  "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.12.tgz",
  "integrity": "sha512-xTFBs3ipFQNmjCUkDj6ZzRJvs97IyazFHBKWtrQrLiYs0Zk0GANob1hkMRlQUQXbJrpQGwnI+/yU4oyD4ohvpw=="
},

Since ^ updates to the latest minor version (the second number), it's advisable to specify a specific version. Therefore, going from 1.9.* to 1.10.* and using ^1.9.6 means removing your lock file and reinstalling may result in obtaining 1.10.12.

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

What is the most efficient way to organize an array by date?

Here is the data I have: const data = [{date: "2022-05-10 13:36:00", open: 155.535, low: 155.4, high: 155.67, close: 155.44}, {date: "2022-05-10 13:35:00", open: 155.23, low: 155.2102, high: 155.62, close: 155.53}, {date: "2022-05 ...

Avoiding the sudden appearance of unstyled content in Single-File Components

I am looking to update my HTML navigation <div id="header-wrapper"> <div id="header-logo-title"> <nav> <ul id='mainNav'> <li>Home</li> </ul> </nav> ...

Give Jquery a quick breather

My goal is to have my program pause for 3 seconds before continuing with the rest of the code. I've been researching online, but all I can find are methods that delay specific lines of code, which is not what I need. What I would like to achieve look ...

Basic library using babel, TypeScript, and webpack - Error: (...) is not a recognized function; within Object.<anonymous>

Recently, I encountered a strange issue while trying to bundle a simple function using babel, typescript, and webpack. You can find the example that is not working at this link. To test it, simply download the code, run npm/yarn install, npm/yarn run buil ...

Exploring the world of Vue.js object mapping

I currently have the following object: data: () => ({ customer: { item: { name: undefined }} }) This object is being used in the template as follows: <v-number separator="." decimal="2" ...

Can you explain the distinction between data-ng and ng?

I recently came across a discussion about the distinction between ng-* and data-ng-* in AngularJS. Apparently, using data-ng-* ensures that the HTML remains valid. But I can't help but wonder, why is this necessary when I can simply declare the ang ...

It appears that Yarn is having trouble properly retrieving all the necessary files for a package

Recently, I encountered a strange issue in our project involving 3 microservices, all using the exceljs library. Two of the microservices successfully download all necessary files for this package through yarn. However, the third microservice is missing ...

Avoid having logs displayed on the server end when utilizing console.log commands

Being new to JavaScript and Node.js, I am attempting to have my application output logs on the server side. getUser.onclick = function () { console.log('Server running at http://127.0.0.1:1337/'); var req = new XMLHttpRequest(); r ...

What is the process for placing the error (404) page in the "dist" folder in a nuxt project?

I successfully implemented an error page following the documentation provided. https://nuxtjs.org/docs/2.x/concepts/views#error-page To achieve this, I created an error.vue file in the /layouts directory and assigned a custom layout to it. <template&g ...

Tips for incorporating the multiply times async function into mocha tests

I am attempting to utilize the async function foo multiple times in my mocha tests. Here is how I have structured it: describe('This test', () => { const foo = async () => { const wrapper = mount(Component); const button ...

Tips for correctly linking JS and CSS resources in Node.js/Express

I have a JavaScript file and a stylesheet that I am trying to link in order to use a cipher website that I created. Here is my File Path: website/ (contains app.js/html files and package json) website/public/css (contains CSS files) website/public/scri ...

React not correctly returning multiple values in function: TypeError: cannot iterate over undefined (cannot read property Symbol(Symbol.iterator))

Although there are numerous questions with a similar title, none of them address my specific concern. My current project involves a React app that retrieves data from a backend built with Node.js and MySQL. However, I encountered the following error while ...

"Encountering a 403 error while using the request method in Node.js

app.post("/",function(req,res){ // console.log(req.body.crypto); request("https://apiv2.bitcoinaverage.com/indices/global/ticker/all?crypto=BTC&fiat=USD,EUR",function(error,response,body){ console.error('error:', error ...

Can these two arrays be merged together in JavaScript?

Here is the structure of the first array: [ 0:{program: id_1}, 1: {program: id_2} ] Now, let's take a look at the second array: [ 0: [ 0: {lesson: name_1}, 1: {lesson: name_2} ], 1: [ 0: {lesson: name_3} ] ] I am attempti ...

Issues concerning date and time manipulation - Library Moment.js

As a beginner in JavaScript, I've been working on an activity that generates a table of train times based on user input. However, I'm facing issues with formatting the arrival time correctly. Whenever I input the arrival time in military format ( ...

How can a method inside an object property of the same class be invoked in JavaScript?

I'm faced with a bit of confusion here. I have a class property called hotspot of type object, declared as follows: Cannon.prototype.hotspot = {stuff: this.blah(...) }; The method blah() is actually a prototype of the same 'class': Canno ...

Encountering a 127 error when trying to install npm on an EC2

I’m currently in the process of setting up npm on my Amazon EC2 instance. So far, I’ve successfully installed both Git and Node.js on the instance. This is the series of commands I used: git clone git://github.com/joyent/node.git cd node git checkou ...

Problem with Ember.js installation on Windows: Application fails to load due to missing module 'ember-cli/lib/broccoli/ember-app'

Recently set up ember.js on my Windows XP machine and I am new to using ember.js for development. All the necessary components seem to be installed and working fine. After running $ember version, I got: version: 0.2.3 node: 0.12.2 npm: 2.7.6 Running ...

Struggling to retrieve scope data within directive from controller in AngularJS

As a newcomer to AngularJS, I have utilized a service to retrieve data from the backend and received it in the controller. Now, my task is to parse these values and dynamically generate elements in a directive. However, when attempting to do so, I am encou ...

Display a string variable in a field using JavaScript and JQuery

I am currently coding in JavaScript using JQuery, and I am facing an issue when trying to display the content of variables in a field. Here is my code snippet: function editEvolution(pos, nature, desc, di) { $('#diE').val(di); $(&apo ...