patch-package icon indicating copy to clipboard operation
patch-package copied to clipboard

Error While applying patch to react-native on expo project

Open ErrorCode996 opened this issue 2 years ago • 2 comments

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).

ErrorCode996 avatar Mar 31 '23 11:03 ErrorCode996

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 avatar May 21 '23 15:05 nateshmbhat

Updating to latest patch-package version fixed it 👍🏻

nateshmbhat avatar May 21 '23 15:05 nateshmbhat