Home
Support Forums

React-animated-cursor peer dep

Hello! I recently added an animated cursor to my NextJS site, using react-animated-cursor. However, the deployment fails citing it could not resolve the following dependency: peer react@"^16.13.1" from react-animated-cursor@2.2.0

Hi @colenh

Could you share the link to the deploy log, or post the deploy log (around the line with the error) here. One line from a log doesn’t provide a lot to go on sorry.

Of course, I’m sorry.

12:56:01 AM: Installing NPM modules using NPM version 8.1.2 12:56:03 AM: npm ERR! code ERESOLVE 12:56:03 AM: npm ERR! ERESOLVE unable to resolve dependency tree 12:56:03 AM: npm ERR! 12:56:03 AM: npm ERR! While resolving: undefined@undefined 12:56:03 AM: npm ERR! Found: react@17.0.2 12:56:03 AM: npm ERR! node_modules/react 12:56:03 AM: npm ERR! react@"^17.0.2" from the root project 12:56:03 AM: npm ERR! 12:56:03 AM: npm ERR! Could not resolve dependency: 12:56:03 AM: npm ERR! peer react@"^16.13.1" from react-animated-cursor@2.2.0 12:56:03 AM: npm ERR! node_modules/react-animated-cursor 12:56:03 AM: npm ERR! react-animated-cursor@"^2.2.0" from the root project 12:56:03 AM: npm ERR! 12:56:03 AM: npm ERR! Fix the upstream dependency conflict, or retry 12:56:03 AM: npm ERR! this command with --force, or --legacy-peer-deps 12:56:03 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution. 12:56:03 AM: npm ERR! 12:56:03 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report. 12:56:03 AM: npm ERR! A complete log of this run can be found in: 12:56:03 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-12-28T05_56_03_850Z-debug.log 12:56:03 AM: Error during NPM install 12:56:03 AM: Build was terminated: Build script returned non-zero exit code: 1

Thanks @colenh

This issue here is react-animated-cursor has two peer dependencies as seen in the package-lock.json

"peerDependencies": {
  "react": "^16.13.1",
  "react-dom": "^16.13.1"
}

while your project is set up using React v17.0.2 (a full major-version higher.) If downgrading react in the project is not an option, you will need to with the --force or --legacy-peer-deps flags with the NPM_FLAGS environment variable.