Closed MoniruzzamanBappy closed 1 day ago
Solution: Update peerDependencies and Reinstall with Compatibility Adjust peerDependencies in package.json: Ensure that your Nexcade UI library’s package.json file includes a flexible peerDependencies specification that allows multiple versions of React (e.g., both React 17 and 18).
// Nexcade UI package.json
{
"peerDependencies": {
"react": "^17 || ^18",
"react-dom": "^17 || ^18"
}
}
Reinstall with Compatibility Flags: When installing Nexcade UI or other dependencies, use the --legacy-peer-deps flag to bypass dependency conflicts.
npm install nexcade-ui --legacy-peer-deps
Code Example for Compatibility Check
In your local project, ensure you are importing Nexcade UI components correctly and verify that React is compatible.
import React from "react";
import { Header, Footer, Spinner } from "nexcade-ui";
function App() {
return (
<div>
<Header title="Welcome to Nexcade UI" />
<Spinner />
<Footer />
</div>
);
}
export default App;
The Nexcade UI package may specify a different version of React in its peerDependencies than the version required in your local project. This issue commonly occurs if the package was developed with an older or newer version of React. The error usually looks something like: