0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

npm ERR! code ERESOLVEが発生して困った話

Posted at

npm installをしていたらエラーが発生しました。

PS E:\workspace\Python\tmp\front-back-end\frontend> npm install react-query
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: frontend@8.19.4
npm ERR! Found: react@19.1.0
npm ERR! node_modules/react
npm ERR! react@"^19.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || ^17.0.0 || ^18.0.0" from react-query@3.39.3
npm ERR! node_modules/react-query
npm ERR! react-query@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

npm audit fix --forcerm -rf node_modules package-lock.json, npm cache clean --forceをしても全く直りませんでした。

原因

react-scriptsが悪さをしてました。

react-scriptsを使っているとreact-scriptsのバージョンが古すぎて他のパッケージと競合が起きる問題が発生しました
create-react-app がどうやらメンテされなくなったようで react-script が邪魔をして
TypeScript を5以降にバージョンアップできなくなりました。
https://zenn.dev/xronotech/articles/11e671bf0315e7

package.jsonからreact-scriptsを外してnpm installしたところ、うまくいきました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?