I'm new at at creating node modules.
I'm currently building a component library for a React-native app.
It works fine when a component does not rely on a third-party library but when it does, it seems like installing the library does not install the dependencies.
Here's a simple example:
package.json from the component library :
"dependencies": {
"lottie-ios": "3.2.3",
"lottie-react-native": "^5.1.3"
},
Then I tried to add it as peerDependencies but it didn't solve the issue :
"peerDependencies": {
"react": "*",
"react-native": "*",
"lottie-ios": "3.2.3",
"lottie-react-native": "^5.1.3"
},
(Since then I removed it from the peerDependencies).
Back to the RN project I want to implement, when installing the component library, lottie does not install.
Am I missing something here ?
CodePudding user response:
There's an issue with the dependencies used by your dependencies. Your react version is not compatible (according to npm) with the react version used by one of your dependencies. Thus conflicting in a peer dependency conflict. This is an issue if you're using npm version > 6.
You can resolve by passing the --legacy-peer-deps
flag when running npm install
. Resulting in: npm i --legacy-peer-deps