ds300 / patch-package

Fix broken node modules instantly 🏃🏽‍♀️💨
MIT License
10.26k stars 287 forks source link

Error While applying patch to react-native on expo project #459

Open ErrorCode996 opened 1 year ago

ErrorCode996 commented 1 year ago

package.json

"react-native": "https://github.com/expo/react-native/archive/sdk-46.0.0.tar.gz"

Error on terminal

**ERROR** Failed to apply patch for package react-native at path

    node_modules/react-native

  This error was caused because patch-package cannot apply the following patch file:

    patches/react-native+0.69.1.patch

  Try removing node_modules and trying again. If that doesn't work, maybe there was
  an accidental change made to the patch file? Try recreating it by manually
  editing the appropriate files and running:

    patch-package react-native

  If that doesn't work, then it's a bug in patch-package, so please submit a bug
  report. Thanks!

    https://github.com/ds300/patch-package/issues

---
patch-package finished with 1 error(s).
nateshmbhat commented 1 year ago

Facing same issue : Here's my error :

$: npx patch-package react-native

patch-package 6.4.7
• Creating temporary folder
SyntaxError: Unknown token: { line: 3, col: 2, type: 'INVALID', value: undefined } 3:2 in lockfile
    at Parser.unexpected (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/@yarnpkg/lockfile/index.js:5064:11)
    at Parser.parse (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/@yarnpkg/lockfile/index.js:5193:14)
    at parse (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/@yarnpkg/lockfile/index.js:5262:17)
    at Object.module.exports.exports.default (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/@yarnpkg/lockfile/index.js:4835:96)
    at Object.getPackageResolution (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/patch-package/dist/getPackageResolution.js:27:40)
    at Object.makePatch (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/patch-package/dist/makePatch.js:52:63)
    at /Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/patch-package/dist/index.js:52:25
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/patch-package/dist/index.js:51:22)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/patch-package/dist/makePatch.js:218
        throw e;
        ^

SyntaxError: Unknown token: { line: 3, col: 2, type: 'INVALID', value: undefined } 3:2 in lockfile
    at Parser.unexpected (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/@yarnpkg/lockfile/index.js:5064:11)
    at Parser.parse (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/@yarnpkg/lockfile/index.js:5193:14)
    at parse (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/@yarnpkg/lockfile/index.js:5262:17)
    at Object.module.exports.exports.default (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/@yarnpkg/lockfile/index.js:4835:96)
    at Object.getPackageResolution (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/patch-package/dist/getPackageResolution.js:27:40)
    at Object.makePatch (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/patch-package/dist/makePatch.js:52:63)
    at /Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/patch-package/dist/index.js:52:25
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/natesh.bhat/Desktop/isha/sgapp-copy/node_modules/patch-package/dist/index.js:51:22)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
nateshmbhat commented 1 year ago

Updating to latest patch-package version fixed it 👍🏻