Skip to content

Inconsistent information provided when patching fails #20

@rodnolan

Description

@rodnolan

This issue seems to be similar to #19 so I updated my yarn and node versions. I am on 64-bit Windows 10 with yarn v1.1.0, node 8.6.0 and npm v5.3.0. I can successfully generate a patch file and I have successfully applied the very same file in the past with $yarn prepare. I have noticed that this issue seems to occur when I switch branches in git.

$ yarn prepare
yarn run v1.1.0
$ patch-package
patch-package: Applying patches...

**ERROR** Failed to apply patch for package react-native-deprecated-custom-components

  This error was caused because react-native-deprecated-custom-components has changed since you
  made the patch file for it. This introduced conflicts with your patch,
  just like a merge conflict in Git when separate incompatible changes are
  made to the same piece of code.

  Maybe this means your patch file is no longer necessary, in which case
  hooray! Just delete it!

  Otherwise, you need to manually fix the patch file. Or generate a new one

  To generate a new one, just repeat the steps you made to generate the first
  one, but accounting for the changes in react-native-deprecated-custom-components.

  i.e. make changes, run `patch-package react-native-deprecated-custom-components`, and commit.

  To manually fix a patch file, Run:

     patch -p1 -i patches/react-native-deprecated-custom-components+0.1.1.patch --verbose --dry-run

  To list rejected hunks. A 'hunk' is a section of patch file that describes
  one contiguous area of changes. They are numbered from 1 and begin with lines
  that look like this:

    diff --git a/node_modules/thing/thing.js b/node_modules/thing/thing.json

  Remove the conflicting hunks, then manually edit files in

    node_modules/react-native-deprecated-custom-components

  to reflect the changes that the conflicting hunks were supposed to make.

  Then run `patch-package react-native-deprecated-custom-components`

  Info:
    Patch was made for version 0.1.1
    Meanwhile node_modules/react-native-deprecated-custom-components is version 0.1.1

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Note that the info: section seems to indicate a belief that the version numbers are out of sync but they are actually identical. Better error messages would be helpful for debugging this.

Here is the package.json file from the library I'm trying to patch in my node_modules folder:

{
  "name": "react-native-deprecated-custom-components",
  "version": "0.1.1",
  "description": "Deprecated custom components that originally shipped with React Native",
  "repository": {
    "type": "git",
    "url": "git@github.com:facebookarchive/react-native-custom-components.git"
  },
  "main": "src/CustomComponents.js",
  "dependencies": {
    "fbjs": "~0.8.9",
    "immutable": "~3.7.6",
    "prop-types": "^15.5.10",
    "react-timer-mixin": "^0.13.2",
    "rebound": "^0.0.13"
  },
  "peerDependencies": {
    "react-native": "*"
  }
}

and here is the patch file itself:

diff --git a/node_modules/react-native-deprecated-custom-components/src/NavigatorBreadcrumbNavigationBar.js b/node_modules/react-native-deprecated-custom-components/src/NavigatorBreadcrumbNavigationBar.js
index 704216e..09efbbe 100644
--- a/node_modules/react-native-deprecated-custom-components/src/NavigatorBreadcrumbNavigationBar.js
+++ b/node_modules/react-native-deprecated-custom-components/src/NavigatorBreadcrumbNavigationBar.js
@@ -93,9 +93,9 @@ class NavigatorBreadcrumbNavigationBar extends React.Component {
       titleContentForRoute: PropTypes.func,
       iconForRoute: PropTypes.func,
     }),
-    navState: React.PropTypes.shape({
-      routeStack: React.PropTypes.arrayOf(React.PropTypes.object),
-      presentedIndex: React.PropTypes.number,
+    navState: PropTypes.shape({
+      routeStack: PropTypes.arrayOf(PropTypes.object),
+      presentedIndex: PropTypes.number,
     }),
     style: ViewPropTypes.style,
   };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions