执行 yarn 时,报错:Failed to apply patch for package laravel-mix. This happened because the patch file patches\laravel-mix+6.0.43.patch could not be parsed.
1、执行 yarn 时,报错:Failed to apply patch for package laravel-mix.This happened because the patch file patches\laravel-mix+6.0.43.patch could not be parsed.。如图1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | PS E:\wwwroot\object> yarn yarn install v1.22.15 [1/5] Validating package.json... [2/5] Resolving packages... success Already up-to-date. $ patch-package patch-package 6.4.7 Applying patches... concat @1 .0.3 <img draggable= "false" role= "img" class= "emoji" alt= " src= "https://s.w.org/images/core/emoji/15.1.0/svg/2714.svg" > eslint-plugin-jsonc @2 .3.0 <img draggable= "false" role= "img" class= "emoji" alt= " src= "https://s.w.org/images/core/emoji/15.1.0/svg/2714.svg" > **ERROR** Failed to apply patch for package laravel-mix This happened because the patch file patches\laravel-mix+6.0.43.patch could not be parsed. If you just upgraded patch-package, you can try running: cd patches\laravel-mix+6.0.43.patc patch -p1 -i h npx patch-package laravel-mix 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. |
2、查看 Git 日志,patches\laravel-mix+6.0.43.patch 的上一个版本是:patches\laravel-mix+6.0.48.patch。如图2
3、删除掉目录:node_modules 后,再次执行:yarn,仍然报同样的错误。如图3
4、参考提示,执行:npx patch-package laravel-mix。如图4
1 2 3 4 5 6 7 8 9 10 11 12 | PS E:\wwwroot\object> npx patch-package laravel-mix patch-package 6.4.7 • Creating temporary folder • Installing laravel-mix @6 .0.43 with yarn • Diffing your files with clean files <img draggable= "false" role= "img" class= "emoji" alt= " src= "https://s.w.org/images/core/emoji/15.1.0/svg/2049.svg" > Not creating patch file for package 'laravel-mix' <img draggable= "false" role= "img" class= "emoji" alt= " src= "https://s.w.org/images/core/emoji/15.1.0/svg/2049.svg" > There don't appear to be any changes. npm notice npm notice New minor version of npm available! 8.1.2 -> 8.12.1 npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.12.1 npm notice Run npm install -g npm @8 .12.1 to update! npm notice |
5、再次执行:yarn,仍然报错。参考:https://github.com/ds300/patch-package/issues/191 。将换行符从 CRLF 替换为 LF。不再报错。如图5
近期评论