Search code examples
reactjsnpmnpm-install

How do i do NPM install --force on heroku


So I have to use npm i react-google-login --force to install the google login component into my local machine, I used ci/cd on Heroku connected my GitHub but it is refusing to install the react-google-login component on Heroku. Please how can I use the npm I react-google-login --force on Heroku? This is the error I'm getting below on my deploy.

-----> 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 

Solution

  • Put this option in your repository's .npmrc:

    force=true
    

    Alternatively, to revert back to npm's looser peer dependency checking:

    legacy-peer-deps=true