Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to fix binary_check.sh for non-npm-installed PCs #47

Open
0xDaizz opened this issue Aug 14, 2023 · 1 comment
Open

Need to fix binary_check.sh for non-npm-installed PCs #47

0xDaizz opened this issue Aug 14, 2023 · 1 comment

Comments

@0xDaizz
Copy link

0xDaizz commented Aug 14, 2023

I used forge test with my new PC, then here comes an error.

2023-08-14T17:01:18.492771Z ERROR apply:ext: evm::cheatcodes: non-empty stderr args=["./lib/foundry-huff/scripts/binary_check.sh"] stderr="./lib/foundry-huff/scripts/binary_check.sh: line 3: npm: command not found\n"
2023-08-14T17:01:18.492906Z ERROR forge::runner: setUp failed reason="Invalid huffc binary. Run `curl -L get.huff.sh | bash` and `huffup` to fix."

Running 1 test for test/Sando.t.sol:SandoTest
[FAIL. Reason: Setup failed: Invalid huffc binary. Run `curl -L get.huff.sh | bash` and `huffup` to fix.] setUp() (gas: 0)
Test result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 30.71ms
Ran 2 test suites: 3 tests passed, 1 failed, 0 skipped (4 total tests)

It was really weird since I have my huff-rs installed already.

So, I checked binary_check.sh file and got the answer.

#! /bin/bash

if ! [[ "$(npm list -g huffc)" =~ "empty" ]]; then
  # huffc was installed via npm, return 0x00
  echo -n 0x00
elif [[ "$(yarn global list)" =~ "huffc" ]]; then
  # huffc was installed via yarn, return 0x00
  echo -n 0x00
else
  echo -n 0x01
fi

I have not installed npm before on this computer,
so I managed to install npm via sudo apt install npm and then retried.

The result was successful.
although forge emitted one error for not being installed yarn, the compiler ran successful and the test was great.

2023-08-14T17:06:43.712365Z ERROR apply:ext: evm::cheatcodes: non-empty stderr args=["./lib/foundry-huff/scripts/binary_check.sh"] stderr="./lib/foundry-huff/scripts/binary_check.sh: line 6: yarn: command not found\n"

So I think that there should be a fix on the file "binary_check.sh" for those do not have npm nor yarn installed on their computer. thanks!

@giggling-ginger
Copy link

thx!! very helpful!!! i ran into same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants