Unable to run Medusa due crytic-compile error, corrupted lockfile due to NPM bug
I am unable to run medusa due to encountering the issue:
⇾ Reading the configuration file at: /Users/ljz3/Desktop/All/PersonalCoding/testing/hardhat-medusa/medusa.json
⇾ Compiling targets with crytic-compile
error Failed to compile target
‣ error while executing crytic-compile:
OUTPUT:
INFO:CryticCompile:'npx hardhat clean' running (wd: /Users/ljz3/Desktop/All/PersonalCoding/testing/hardhat-medusa)
INFO:CryticCompile:'npx hardhat clean --global' running (wd: /Users/ljz3/Desktop/All/PersonalCoding/testing/hardhat-medusa)
INFO:CryticCompile:'npx hardhat compile --force' running (wd: /Users/ljz3/Desktop/All/PersonalCoding/testing/hardhat-medusa)
ERROR:CryticCompile:'npx' returned non-zero exit code 1
ERROR:CryticCompile:Error HH18: You installed Hardhat with a corrupted lockfile due to the NPM bug #4828.
stderr:
stderr: Please delete your node_modules, package-lock.json, reinstall your project, and try again.
stderr: For more info go to https://hardhat.org/HH18 or run Hardhat with --show-stack-traces
ERROR:CryticCompile:Compilation failed. Can you run build command?
/Users/ljz3/Desktop/All/PersonalCoding/testing/hardhat-medusa/artifacts/build-info is not a directory.
ERROR: exit status 255
This is on a minimal hardhat repository created with npx hardhat init.
Installation steps I went through:
- Downloaded MacOS binary through https://github.com/crytic/medusa/releases
- Placed binary file into /usr/local/bin
- Ran
pip3 install crytic-compile - Ran
medusa init - Ran
medusa fuzz
Environment info: OS: MacOS V14.2, Chip: M2 max node -v: 18.17.0 npm -v: 9.6.7 pip3 --version: 23.3.1
Can you reproduce just running crytic-compile .?
Hello @ggrieco-tob, thank you for the response.
I ran crytic-compile . on the same repo, and it seems that the command ran successfully with logs:
crytic-compile .
INFO:CryticCompile:'npx hardhat clean' running (wd: /Users/kevinli/Desktop/All/PersonalCoding/testing/hardhat-medusa)
INFO:CryticCompile:'npx hardhat clean --global' running (wd: /Users/kevinli/Desktop/All/PersonalCoding/testing/hardhat-medusa)
INFO:CryticCompile:'npx hardhat compile --force' running (wd: /Users/kevinli/Desktop/All/PersonalCoding/testing/hardhat-medusa)
It seems that this issue is specific to medusa, thanks for confirming that. @anishnaik will take care
Appears that this is an issue with the release binary, building it from source works.
@ljz3 thanks for the additional details. Will look more into this this week.
"compilation": {
"platform": "crytic-compile",
"platformConfig": {
"target": ".",
"solcVersion": "",
"exportDirectory": "",
"args": [
"--compile-force-framework",
"foundry",
"--foundry-compile-all",
"--foundry-out-directory",
"forge-artifacts"
]
}
},
Similar issue here.