skip to Main Content

In a react-native project, there is mocha (9.2.0) as a devDependency like the following –

react-native-svg –

"dependencies": {
  "css-select": "^5.1.0",
  "css-tree": "^1.1.3"
}

css-tree –

"devDependencies": {
  ...
  "mocha": "9.2.0",
  ...
}

When I perform the app bundle, I found the mocha is there.

enter image description here

Now I want to upgrade the mocha version to 10.1.0. I can do that by modifying the package-lock.json. But is it possible to do the same without modifying the package-lock.json by using the npm override or resolution or something similar to that?

2

Answers


  1. You can try this command but it will still update your package.json ultimately

    npm install [email protected] --save --only=dev
    
    Login or Signup to reply.
  2. you can use patch-package https://github.com/ds300/patch-package, modify dependencies in node_modules and then patch it with npx patch-package css-tree or what package do you want to fix.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search