公司服务器一直在用 php7.4,最近的项目如果依赖 thinkphp 的,使用 composer install 总是会报错:
Your requirements could not be resolved to an installable set of packages.
上一次使用 php8.5 安装了一个项目,确实没有这个问题,但是框架中一堆旧代码需要手动修改,就很扯,所以这一次决定无论如何,也要解决这个问题。
最近发现 ai 用习惯了,都不知道如何解决问题了。
这次特意留意看了下命令行中的错误提示:
Problem 1
- Root composer.json requires topthink/framework ^6.0.0, found topthink/framework[v6.0.0, ..., v6.1.5] but these were not loaded, because they are affected by security advisories. To ignore the advisories, add ("PKSA-wpgp-v5cy-4kds") to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.
其实大概看下,就知道解法,因为提示明确说了,你可以关闭这个安全特性,只要在 audit 配置中,设置 block-insecure 为 false 即可。
根据提示,修改下 composer.json 文件,添加对应配置:
再用 composer install安装,thinkphp 6.1 也可以正常被安装了。
















