1
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 installができない時

1
Posted at

npm installをしたら下記のエラーが出た

% npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: react-scripts@5.0.1
npm ERR! Found: typescript@5.7.2
npm ERR! node_modules/typescript
npm ERR!   dev typescript@"5.7.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1 || ^4" from react-scripts@5.0.1
npm ERR! node_modules/react-scripts
npm ERR!   react-scripts@"^5.0.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: typescript@4.9.5
npm ERR! node_modules/typescript
npm ERR!   peerOptional typescript@"^3.2.1 || ^4" from react-scripts@5.0.1
npm ERR!   node_modules/react-scripts
npm ERR!     react-scripts@"^5.0.0" 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.

this command with --force or --legacy-peer-deps
(--force または --legacy-peer-deps オプションを指定してこのコマンドを実行してください。)

違いは何か

--legacy-peer-deps: npmのバージョン7以降、peer dependenciesの競合があるとインストールが止まるようになりました。--legacy-peer-deps はnpm v6以前の古い挙動に戻すオプションです。競合があってもある程度と無視してインストールしてくれます
--force : 強制インストール。競合だけでなく、あらゆる警告やチェックを無視して強制インストールします。キャッシュも無視して再ダウンロードします。

#対応

npm install --legacy-peer-deps
1
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
1
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?