我如何在heroku上进行NPM安装--force

问题描述 投票:0回答:1

所以我必须使用

npm i react-google-login --force
将google登录组件安装到我的本地计算机中,我在Heroku上使用ci/cd连接了我的GitHub,但它拒绝在Heroku上安装react-google-login组件。请问如何在 Heroku 上使用
npm I react-google-login --force
? 这是我在部署时遇到的错误。

-----> Installing dependencies        
remote:        Installing node modules        
remote:        npm ERR! code ERESOLVE        
remote:        npm ERR! ERESOLVE could not resolve        
remote:        npm ERR!         
remote:        npm ERR! While resolving: [email protected]        
remote:        npm ERR! Found: [email protected]        
remote:        npm ERR! node_modules/react        
remote:        npm ERR!   react@"^18.1.0" from the root project        
remote:        npm ERR!   peer react@"^16 || ^17 || ^18" from @headlessui/[email protected]        
remote:        npm ERR!   node_modules/@headlessui/react        
remote:        npm ERR!     @headlessui/react@"^1.6.4" from the root project        
remote:        npm ERR!   11 more (@heroicons/react, @testing-library/react, formik, ...)        
remote:        npm ERR!         
remote:        npm ERR! Could not resolve dependency:        
remote:        npm ERR! peer react@"^16 || ^17" from [email protected]        
remote:        npm ERR! node_modules/react-google-login        
remote:        npm ERR!   react-google-login@"^5.2.2" from the root project        
remote:        npm ERR!         
remote:        npm ERR! Conflicting peer dependency: [email protected]        
remote:        npm ERR! node_modules/react        
remote:        npm ERR!   peer react@"^16 || ^17" from [email protected]        
remote:        npm ERR!   node_modules/react-google-login        
remote:        npm ERR!     react-google-login@"^5.2.2" from the root project        
remote:        npm ERR!         
remote:        npm ERR! Fix the upstream dependency conflict, or retry        
remote:        npm ERR! this command with --force, or --legacy-peer-deps        
remote:        npm ERR! to accept an incorrect (and potentially broken) dependency resolution.        
remote:        npm ERR!         
remote:        npm ERR! See /tmp/npmcache.7FR4A/eresolve-report.txt for a full report.        
remote:                
remote:        npm ERR! A complete log of this run can be found in:        
remote:        npm ERR!     /tmp/npmcache.7FR4A/_logs/2022-07-11T20_31_06_507Z-debug-0.log        
remote: 
remote: -----> Build failed 
reactjs npm npm-install
1个回答
18
投票

将此选项放入您的存储库中

.npmrc
:

force=true

或者,恢复到 npm 更宽松的对等依赖检查:

legacy-peer-deps=true
© www.soinside.com 2019 - 2024. All rights reserved.