简体   繁体   中英

Installing specific version of dependencies for a package inside that package in package.json

I know the title is confusing but I wasn't sure how to word my issue...

I am using a package in my App called "react-dnd-html5-backend". This specific package has a dependency called "autobind-decorator". autobind-decorator recently posted an update to their package that introduced conflicts in a few spots in my App. I would like to specify that "react-dnd-html5-backend" use the exact version that I know is compatible wit my code. Is there a way to specify that in my package.json file? To specify the version of "autobind-decorator" that "react-dnd-html5-backend" uses while in my application?

Adding autobind-decorator with a specific version as a dependency into your project's package.json will force to install that version.

Note that react-dnd-html5-backend should support to use autobind-decorator version, if not it will cause a version conflict error.

Thanks Gonzalo! I believe I tried that but was unable to override the version used by "react-dnd-html5-backend" In my impatience I actually found a different solution that I figured I should post in case anyone else runs into the same problem. It looks like you can specify the version of a nested package by using the resolutions field of the package.json:

https://github.com/yarnpkg/rfcs/pull/68/files

Example:
"resolutions": {
    "**/autobind-decorator": "2.1.0"
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM