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

Determine the return type of a function based on a key parameter in an interface

Here is an example of a specific interface: interface Elements { divContainer: HTMLDivElement; inputUpload: HTMLInputElement; } My goal is to create a function that can retrieve elements based on their names: getElement(name: keyof Elements): Elemen ...

How to effectively manage Mongoose Query Exceptions in Express.js

Let's imagine a scenario where I need to execute a Mongoose query in an Express post route: app.post("/login",(req,res)=>{ const username = req.body.username const password = req.body.password User.find({username:username},(er ...

What is the best way to include a title and a close button at the top of a menu, before the first item, when a button menu is clicked in material-ui?

One of the challenges I'm facing is adding a title to an icon button menu that contains a checkbox list of menu items. When the user clicks on the icon and opens the dropdown, I want the title to appear at the top of the dropdown along with a close bu ...

Best practices for efficiently utilizing setInterval with multiple HTTP requests in NodeJS

Imagine you have a collection with 3 to 5 URLs. You want to send requests every 5 seconds, one by one. Here is how I approached this: setInterval(() => { array.forEach(element => { request .get(element.url) .on('response', ...

Guide on installing Ionic - Facing errors such as "npm ERR! path" and more

Hi there, looking for some help! I'm having issues installing IONIC on Windows. Despite having Node, NPM, and Cordova installed, I keep encountering errors when trying to install IONIC. Here is the error log I received: Seems like there's trou ...

Firebase disconnect update functionality

I am currently working on a node in firebase that keeps track of all the players in my game. This list is updated whenever new players join. When I, as the current user, disconnect from the game, I want to be able to remove myself from this list. Since th ...

Data binding in Vue does not function properly within functional components

Clicking the button will cause the number n to increase, but the UI will display it as constant 1. <script> let n = 1 function add() { console.log(n) return ++n } export default { functional: true, render(h, ctx) { return (<div> ...

Ways to initiate state transition from child component to parent component using React Hooks?

In the parent component, I have the following: const [updateQuantity, quantity] = useState(1); const handleChangeQuantity = e => { console.log(e.target.value); console.log("TEST"); updateQuantity(e.target.value); }; I the ...

The use of pattern fill in fabric.js is causing a decrease in rendering speed

I recently attempted to create a clip mask effect on a large image by using the picture as a pattern and setting it to the svg paths that support the desired shape. You can view the slow-loading jsfiddle example here: http://jsfiddle.net/minzojian/xwurbw ...

I am a beginner in node.js and currently exploring the concept of asynchronous callbacks and how they function

When running the following code, "one" and "two" are displayed as output but "three" is absent. Can someone provide an explanation as to why "three" is not showing up in the output? Despite trying various methods, I am still unable to pinpoint the cause ...

What steps can be taken to resolve the issue of the <td> element not being allowed as a child of an <a> tag?

https://i.stack.imgur.com/nsdA7.png How can I address these warnings? I utilized the material UI table component and suspect that the warnings are originating from component={Link} to={/patient/${patient.id}} <TableContainer className={styles.tableCo ...

Flask - Refreshing Forms Dynamically

In an effort to enhance the responsiveness of my app, I am looking for a way to prevent the page from reloading every time a POST request is sent. My current setup includes a dynamically generated form with input fields designed like this: <div class=&q ...

What is the process of adding a private Git library to an npm project?

I am currently working on a project that has its own private project library accessible directly to me at . In the package.json file, it is required like this: "dependencies": { "@some-project/some-utils": "0.1.42", ...

"Configuration files for webpack and Vue: webpack.config.js and vue.config

Just recently diving into exploring Vue, I decided to kick off a project from the ground up. My current requirement is to incorporate vuetify. But it dawned on me that I lack both webpack.config.js and vue.config.js. Is it necessary for me to utilize npm ...

The tooltip chart is not displaying all of its data

I create a dynamic tooltip with a custom chart inside of it. tooltip: { borderRadius: 15, borderWidth: 0, shadow: false, enabled: true, backgroundColor: 'none', useHTML: true, shared: true, formatter: function() { ...

Guide on utilizing FS in Node.js: "I am a fan of the `FS` modules."

After extensively researching this issue within the same forum, I have yet to find a solution. This is the content of my javascript file: const fs = require( 'fs' ); fs.readFile( './test.html', (err, data) => { if (err) throw er ...

$set { "array.variable.value" :"newvalue"} utilize a different term besides "variable" or implement a new variable

When working with mongoose to store user data, one of the attributes is an array called items. In my additems.js file: const User = require('../models/User'); var array = user.items; array.indexOfObject = function (property, value) { ...

Tips for arranging div elements in a grid-like matrix layout

I am facing a challenge in arranging multiple rectangular divs into a grid structure with 10 columns and 10 rows. The CSS styles for the top, bottom, left, or right positions must be in percentages to accommodate zoom in and out functionality without overl ...

The resolvers contain the Query.Mutation but it is not specified in the schema

const { ApolloServer, gql } = require('apollo-server-express'); const express = require('express'); const port = process.env.PORT || 4000; const notes = [ { id: '1', content: 'This is a note', author: 'Adam ...

Acquiring the safe area of the iPhone X through JavaScript

The CSS properties safe-area-inset-left, safe-area-inset-right, safe-area-inset-top, and safe-area-inset-bottom are available, but is there a way to retrieve these values using JavaScript? ...