我在项目中使用了一个名为react typed的软件包,我必须使用--legacy-peer-deps
安装它。
当我这样做的时候,
8:59:31 AM: npm ERR! node_modules/react
8:59:31 AM: npm ERR! react@"^18.2.0" from the root project
8:59:31 AM: npm ERR! peer react@"^18.2.0" from [email protected]
8:59:31 AM: npm ERR! node_modules/react-dom
8:59:31 AM: npm ERR! react-dom@"^18.2.0" from the root project
8:59:31 AM: npm ERR!
8:59:31 AM: npm ERR! Could not resolve dependency:
8:59:31 AM: npm ERR! peer react@"^16.3.0" from [email protected]
8:59:31 AM: npm ERR! node_modules/react-typed
8:59:31 AM: npm ERR! react-typed@"^1.2.0" from the root project
8:59:31 AM: npm ERR!
8:59:31 AM: npm ERR! Conflicting peer dependency: [email protected]
8:59:31 AM: npm ERR! node_modules/react
8:59:31 AM: npm ERR! peer react@"^16.3.0" from [email protected]
8:59:31 AM: npm ERR! node_modules/react-typed
8:59:31 AM: npm ERR! react-typed@"^1.2.0" from the root project
8:59:31 AM: npm ERR!
8:59:31 AM: npm ERR! Fix the upstream dependency conflict, or retry
8:59:31 AM: npm ERR! this command with --force, or --legacy-peer-deps
8:59:31 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
8:59:31 AM: npm ERR!
8:59:31 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
8:59:31 AM: npm ERR! A complete log of this run can be found in:
8:59:31 AM: npm ERR! /opt/buildhome/.npm/_logs/2023-03-01T07_59_31_432Z-debug-0.log
8:59:31 AM: Error during npm install
8:59:31 AM: Build was terminated: Build script returned non-zero exit code: 1
8:59:31 AM: Failing build: Failed to build site
8:59:32 AM: Finished processing build request in 7.285s
字符串
我如何添加遗留的对等deps或部队到vite构建?
我尝试使用vite build --legacy-peer-deps
,我希望它在安装依赖项时触发遗留对等deps,尽管我不确定该命令是否存在,但它仍然显示相同的错误。
1条答案
按热度按时间ikfrs5lh1#
尝试运行
npm config set legacy-peer-deps=true
命令或在根目录下创建一个.npmrc
文件,并在其中添加legacy-peer-deps=true