You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无需安装Hardhat,能否在Foundry项目中运行Slither?

解决Foundry项目无需安装Hardhat运行Slither的问题

问题根源

Slither默认会自动检测项目的编译工具,若未明确指定,它可能误判并尝试调用Hardhat,从而触发该报错。

解决方案

直接指定Slither使用Foundry作为编译框架,执行以下命令:

slither . --compile-force-framework foundry

如果你的Foundry项目已经完成编译,可添加--ignore-compile参数跳过编译步骤,提升运行效率:

slither . --compile-force-framework foundry --ignore-compile

永久配置(可选)

在项目根目录创建.slither.config.json文件,写入以下内容,后续直接运行slither .即可默认使用Foundry:

{
  "compile": {
    "force_framework": "foundry"
  }
}

内容的提问来源于stack exchange,提问作者gagiuntoli

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 04:14:55