How do I update dependency packages in a project without breaking the dependency tree on install?

Viewed 153

I recently created a basic Typescript/React npm package for internal use at the company I'm working for, and since it was my first time building one, I used a tool called create-react-library (found here) to help streamline the process. The library made it quite easy to develop and publish my package, but the problem is that it hasn't been updated recently and thus several of the dependencies are out of date, including the version of React which the rest of our codebase is running on. I can successfully install the package in the main project if I use the --legacy-peer-deps flag on npm install, but that doesn't seem like an ideal solution. What's the best way to update the dependencies of my package without breaking the dependency tree? I tried going through my package.json, manually updating the version numbers to the latest, then deleted node_modules and re-ran npm install, but I got several dependency tree conflicts and the install failed. What's the best approach here?

1 Answers

Just set exact versions or ~, but no ^

Related