没有不值得去解决的问题,也没有不值得去学习的技术!

执行 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.

执行 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
执行 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


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 ✔
eslint-plugin-jsonc@2.3.0 ✔

**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.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


2、查看 Git 日志,patches\laravel-mix+6.0.43.patch 的上一个版本是:patches\laravel-mix+6.0.48.patch。如图2
查看 Git 日志,patches\laravel-mix+6.0.43.patch 的上一个版本是:patches\laravel-mix+6.0.48.patch
图2
3、删除掉目录:node_modules 后,再次执行:yarn,仍然报同样的错误。如图3
删除掉目录:node_modules 后,再次执行:yarn,仍然报同样的错误
图3
4、参考提示,执行:npx patch-package laravel-mix。如图4
参考提示,执行:npx patch-package laravel-mix
图4


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
⁉️  Not creating patch file for package 'laravel-mix'
⁉️  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
再次执行:yarn,仍然报错。参考:https://github.com/ds300/patch-package/issues/191 。将换行符从 CRLF 替换为 LF。不再报错。
图5

PHP / Laravel / Yii2 老项目维护与长期技术支持

如果你的 PHP / Laravel / Yii2 项目已经上线,但遇到原开发离职、Bug 长期无人修复、接口不稳定、性能下降、代码难以接手等问题,可以联系我做一次远程技术排查。

适合以下情况:
✅ 老旧 PHP 系统无人维护
✅ Laravel / Yii2 项目 Bug 修复
✅ 后台管理系统小功能迭代
✅ RESTful API 接口排查
✅ MySQL / Redis / Nginx 性能问题
✅ 长期远程兼职维护

可先从一次小问题开始:
✅ 线上报错排查
✅ 接口异常分析
✅ 慢查询与性能瓶颈定位
✅ 代码结构初步评估
✅ 部署环境与日志检查

如需咨询,请联系我,并注明:PHP 维护咨询

联系方式:
Telegram:@shuijingwan
微信:13980074657
邮箱:shuijingwanwq@gmail.com

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理