Vue は npm を使用して Normalize.css をインストールします。エラー解決

問題の説明

実行: npm installnormalize.css --save コマンドがエラーを報告します。
エラー ログは次のとおりです。

PS D:\VsCodeProject\jingdong> npm install normalize.css --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0    
npm ERR! Found: eslint-plugin-vue@8.7.1
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR!   dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     dev @vue/eslint-config-standard@"^6.1.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.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\zhongxj\AppData\Local\npm-cache\_logs\2023-05-31T00_33_02_888Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\zhongxj\AppData\Local\npm-cache\_logs\2023-05-31T00_33_02_888Z-debug-0.log

理由

npm バージョンの競合の原因

解決

--legacy-peer-depsパラメータを使用する

npm install normalize.css --save --legacy-peer-deps

--legacy-peer-deps フラグは、peerDependency の自動インストールをバイパスし、競合によるインストールの失敗を防ぐために v7 で導入されました。

おすすめ

転載: blog.csdn.net/zxj2589/article/details/130961173