Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch file parse error on Windows #312

Open
stigi opened this issue Apr 26, 2021 · 0 comments
Open

Patch file parse error on Windows #312

stigi opened this issue Apr 26, 2021 · 0 comments

Comments

@stigi
Copy link

stigi commented Apr 26, 2021

A colleague ran into this error on Windows while applying a patch I created on macOS:

Log
Command: node ./run.js                                                                                                                                                                                 
Arguments:                                                                                                                                                                                             
Directory: C:\dev\xxx-app\mobile-app\node_modules\postinstall-postinstall                                                                                                                            
Output:                                                                                                                                                                                                
**ERROR** Failed to apply patch for package @react-native-community/cli-platform-android                                                                                                               
                                                                                                                                                                                                       
  This happened because the patch file patches\@react-native-community+cli-platform-android+5.0.1-alpha.1.patch could not be parsed.                                                                   
                                                                                                                                                                                                       
  If you just upgraded patch-package, you can try running:                                                                                                                                             
                                                                                                                                                                                                       
    cd patches\@react-native-community+cli-platform-android+5.0.1-alpha.1.patc                                                                                                                         
    patch -p1 -i h                                                                                                                                                                                     
    npx patch-package @react-native-community/cli-platform-android                                                                                                                                     
    cd ../..                                                                                                                                                                                           
                                                                                                                                                                                                       
  Otherwise, try manually creating the patch file again.                                                                                                                                               
                                                                                                                                                                                                       
  If the problem persists, please submit a bug report:                                                                                                                                                 
                                                                                                                                                                                                       
    https://github.com/ds300/patch-package/issues/new?title=Patch+file+parse+error&body=%3CPlease+attach+the+patch+file+in+question%3E                                                                 
                                                                                                                                                                                                       
                                                                                                                                                                                                       
error Command failed with exit code 1.                                                                                                                                                                 
child_process.js:650                                                                                                                                                                                   
    throw err;                                                                                                                                                                                         
    ^                                                                                                                                                                                                  
                                                                                                                                                                                                       
Error: Command failed: yarn run postinstall                                                                                                                                                            
                                                                                                                                                                                                       
**ERROR** Failed to apply patch for package @react-native-community/cli-platform-android                                                                                                               
                                                                                                                                                                                                       
  This happened because the patch file patches\@react-native-community+cli-platform-android+5.0.1-alpha.1.patch could not be parsed.                                                                   
                                                                                                                                                                                                       
  If you just upgraded patch-package, you can try running:                                                                                                                                             
                                                                                                                                                                                                       
    cd patches\@react-native-community+cli-platform-android+5.0.1-alpha.1.patc                                                                                                                         
    patch -p1 -i h                                                                                                                                                                                     
    npx patch-package @react-native-community/cli-platform-android                                                                                                                                     
    cd ../..                                                                                                                                                                                           
                                                                                                                                                                                                       
  Otherwise, try manually creating the patch file again.                                                                                                                                               
                                                                                                                                                                                                       
  If the problem persists, please submit a bug report:                                                                                                                                                 
                                                                                                                                                                                                       
    https://github.com/ds300/patch-package/issues/new?title=Patch+file+parse+error&body=%3CPlease+attach+the+patch+file+in+question%3E                                                                 
                                                                                                                                                                                                       
                                                                                                                                                                                                       
error Command failed with exit code 1.                                                                                                                                                                 
                                                                                                                                                                                                       
    at checkExecSyncError (child_process.js:611:11)                                                                                                                                                    
    at execSync (child_process.js:647:15)                                                                                                                                                              
    at Object.<anonymous> (C:\dev\xxx-app\mobile-app\node_modules\postinstall-postinstall\run.js:15:5)                                                                                               
    at Module._compile (internal/modules/cjs/loader.js:1200:30)                                                                                                                                        
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)                                                                                                                          
    at Module.load (internal/modules/cjs/loader.js:1049:32)                                                                                                                                            
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)                                                                                                                                   
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)                                                                                                                
    at internal/main/run_main_module.js:17:47 {                                                                                                                                                        
  status: 1,                                                                                                                                                                                           
  signal: null,                                                                                                                                                                                        
  output: [                                                                                                                                                                                            
    null,                                                                                                                                                                                              
    <Buffer 79 61 72 6e 20 72 75 6e 20 76 31 2e 31 33 2e 30 0a 24 20 70 61 74 63 68 2d 70 61 63 6b 61 67 65 0a 70 61 74 63 68 2d 70 61 63 6b 61 67 65 20 36 2e 34 ... 108 more bytes>,                 
    <Buffer 0a 2a 2a 45 52 52 4f 52 2a 2a 20 46 61 69 6c 65 64 20 74 6f 20 61 70 70 6c 79 20 70 61 74 63 68 20 66 6f 72 20 70 61 63 6b 61 67 65 20 40 72 65 61 63 ... 721 more bytes>                  
  ],                                                                                                                                                                                                   
  pid: 3524,                                                                                                                                                                                           
  stdout: <Buffer 79 61 72 6e 20 72 75 6e 20 76 31 2e 31 33 2e 30 0a 24 20 70 61 74 63 68 2d 70 61 63 6b 61 67 65 0a 70 61 74 63 68 2d 70 61 63 6b 61 67 65 20 36 2e 34 ... 108 more bytes>,           
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
Command '['node.exe', 'C:\\dev\\xxx-app/scripts/yarn-1.13.0.js', 'install', '--frozen-lockfile']' returned non-zero exit status 1.                                                                   

I put up the patch file as a Gist, so you don't have to unzip random files from the web :D

https://gist.github.com/stigi/19427e116e049e5043854a3db33db483

Opening this issue as another example that hopefully can get resolved by #301. I hope it helps confirming the issue and the fix. 🤞

Thanks for all the work ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant