Home > front end >  Updating specific package.json in node_modules
Updating specific package.json in node_modules

Time:11-02

I was wondering if it is possible to update a specific package.json in the node_modules? The reason is because I am getting an invalid hook call error in my code and I believe it is because I have mismatching Reacts. I ran the duplicate react test on the invalid hook call page and I got false, which means I have two reacts. After using "npm ls react" I saw this error:

react@17.0.2 deduped invalid: "^16.4.2" from node_modules/redux-form

In my node_modules/redux-form under peerDependencies I have:

"react": "^16.4.2"

instead of:

"react": "^17.0.2"

I'm not 100% sure this is the fix to my error, but invalid hook call errors are confusing to fix so I'm hoping this is it.

CodePudding user response:

You can rebuild your node_modules

  1. make a backup
  2. remove node modules rm -rf node_modules/
  3. update your packages in package.json
  4. rebuild npm install or npm i
  • Related