Vue使用npm安装Normalize.css报错解决

问题描述

运行:npm install normalize.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标志是在v7中引入的,目的是绕过peerDependency自动安装,防止因为冲突而安装失败

你可能感兴趣的:(Vue问题解决记录,vue.js,npm,css,normalize.css)