Home > Net >  React app deployment error Error during NPM install
React app deployment error Error during NPM install

Time:06-25

This is the error:

12:28:55 PM: Installing NPM modules using NPM version 8.11.0
12:28:56 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
12:28:56 PM: npm WARN config location in the cache, and they are managed by
12:28:56 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
12:28:56 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
12:28:56 PM: npm WARN config location in the cache, and they are managed by
12:28:56 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
12:28:57 PM: npm ERR! code ERESOLVE
12:28:57 PM: npm ERR! ERESOLVE could not resolve
12:28:57 PM: npm ERR!
12:28:57 PM: npm ERR! While resolving: [email protected]
12:28:58 PM: Creating deploy upload records
12:28:57 PM: npm ERR! Found: [email protected]
12:28:57 PM: npm ERR! node_modules/react
12:28:57 PM: npm ERR!   react@"^18.2.0" from the root project
12:28:57 PM: npm ERR!   peer react@"^18.0.0" from @testing-library/[email protected]
12:28:57 PM: npm ERR!   node_modules/@testing-library/react
12:28:58 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
12:28:57 PM: npm ERR!     @testing-library/react@"^13.0.1" from the root project
12:28:57 PM: npm ERR!   5 more (react-dom, react-router, react-router-dom, ...)
12:28:57 PM: npm ERR!
12:28:57 PM: npm ERR! Could not resolve dependency:
12:28:57 PM: npm ERR! peer react@"^16.8.1 || ^17" from [email protected]
12:28:57 PM: npm ERR! node_modules/react-alert
12:28:57 PM: npm ERR!   react-alert@"^7.0.3" from the root project
12:28:57 PM: npm ERR!
12:28:57 PM: npm ERR! Conflicting peer dependency: [email protected]
12:28:57 PM: npm ERR! node_modules/react
12:28:57 PM: npm ERR!   peer react@"^16.8.1 || ^17" from [email protected]
12:28:57 PM: npm ERR!   node_modules/react-alert
12:28:57 PM: npm ERR!     react-alert@"^7.0.3" from the root project
12:28:57 PM: npm ERR!
12:28:57 PM: npm ERR! Fix the upstream dependency conflict, or retry
12:28:57 PM: npm ERR! this command with --force, or --legacy-peer-deps
12:28:57 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
12:28:57 PM: npm ERR!
12:28:57 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
12:28:57 PM: npm ERR! A complete log of this run can be found in:
12:28:57 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-06-25T06_58_56_560Z-debug-0.log
12:28:57 PM: Error during NPM install
12:28:57 PM: Build was terminated: Build script returned non-zero exit code: 1
12:28:58 PM: Failing build: Failed to build site
12:28:58 PM: Finished processing build request in 8.110559255s

I trying to debugging it by Updating node modules but the error can't be solved

CodePudding user response:

It means that your React version (18) is not compatible with react-alert React version (16.8.1 or 17). https://www.npmjs.com/package/react-alert#user-content-peer-dependencies
So my propose is: If this package is necessary, so I recommend to downgrade your React version to 17 or 16.8.1 and test it in your local environment, before deploy. If this does not work, so remove your node_modules folder and install all packages again.

CodePudding user response:

This problem is happening due to the version conflicts. So try the below command to install all dependencies,

npm install --legacy-peer-deps
  • Related