-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fresh windows 10 install - ErrorHook issue #3050
Comments
hmm, this is very strange because this is basically the first thing we're calling so there shouldn't be anything else that sets this. does cast work? that uses the same setup routine just to be sure |
cast doesn't work either, exact same error msg. Also forge --version don't work for the same reason. And yes forge is indeed in .cargo/bin/forge |
weird, I don't have a windows machine so I can only give you some instructions for how to debug this could you try:
the handler is installed here in the main Line 15 in 48d5d79
and this is where it panics Line 62 in 48d5d79
Unclear to me why there would be a hook set already |
any luck debugging this @k2riddim ? |
hey, no sorry, I had to install wsl |
Could reproduce, Windows 10 with a fresh VS 2022 install and using the same command as OP: PS C:\Users\Daniel> forge -V
Error: cannot install provided ErrorHook, a hook has already been installed
Location:
cli\src\handler.rs:62:9
PS C:\Users\Daniel> cast -V
Error: cannot install provided ErrorHook, a hook has already been installed
Location:
cli\src\handler.rs:62:9
PS C:\Users\Daniel> anvil -V
anvil 0.1.0 (76be373 2022-09-06T19:36:52.9230886Z)
PS C:\Users\Daniel> rustup -V
rustup 1.25.1 (bb60b1e89 2022-07-12)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.63.0 (4b91a6ea7 2022-08-08)` Although building from source works just fine: PS C:\Users\Daniel\Documents\GitHub\foundry-rs\foundry> cargo run --bin forge -- -V
Finished dev [unoptimized] target(s) in 0.59s
Running `target\debug\forge.exe -V`
forge 0.2.0 (a78aa49 2022-09-06T19:54:43.4517457Z)
PS C:\Users\Daniel\Documents\GitHub\foundry-rs\foundry> cargo run --bin forge -- init ..\..\DaniPopes\HelloFoundry
Finished dev [unoptimized] target(s) in 0.57s
Running `target\debug\forge.exe init ..\..\DaniPopes\HelloFoundry`
Initializing C:\Users\Daniel\Documents\GitHub\DaniPopes\HelloFoundry...
Installing forge-std in "C:/Users/Daniel/Documents/GitHub/DaniPopes/HelloFoundry\\lib\\forge-std" (url: Some("https://github.com/foundry-rs/forge-std"), tag: None)
Installed forge-std
Initialized forge project.
PS C:\Users\Daniel\Documents\GitHub\foundry-rs\foundry> cd ..\..\DaniPopes\HelloFoundry
PS C:\Users\Daniel\Documents\GitHub\DaniPopes\HelloFoundry> ls
Directory: C:\Users\Daniel\Documents\GitHub\DaniPopes\HelloFoundry
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 06/09/2022 21:58 .github
d----- 06/09/2022 21:58 lib
d----- 06/09/2022 21:58 script
d----- 06/09/2022 21:58 src
d----- 06/09/2022 21:58 test
-a---- 06/09/2022 21:58 143 .gitignore
-a---- 06/09/2022 21:58 97 .gitmodules
-a---- 06/09/2022 21:58 140 foundry.toml
PS C:\Users\Daniel\Documents\GitHub\DaniPopes\HelloFoundry> forge test
[⠊] Compiling...
[⠘] installing solc version "0.8.16"
[⠆] Successfully installed solc 0.8.16
[⠊] Compiling 10 files with 0.8.16
[⠢] Solc 0.8.16 finished in 1.70s
Compiler run successful
Running 2 tests for test/Counter.t.sol:CounterTest
[PASS] testIncrement() (gas: 28312)
[PASS] testSetNumber(uint256) (runs: 256, μ: 27454, ~: 28387)
Test result: ok. 2 passed; 0 failed; finished in 9.35ms |
this doesn't make any sense... |
Same command as OP but using local Foundry repo works: PS C:\Users\Daniel\Documents\GitHub\foundry-rs\foundry> cargo install --path .\cli\ foundry-cli --bins --locked
[...]
Replaced package `foundry-cli v0.2.0 (https://github.com/foundry-rs/foundry#76be373d)` with `foundry-cli v0.2.0 (C:\Users\Daniel\Documents\GitHub\foundry-rs\foundry\cli)` (executables `cast.exe`, `forge.exe`)
PS C:\Users\Daniel\Documents\GitHub\foundry-rs\foundry> forge -V
forge 0.2.0 (a78aa49 2022-09-06T20:12:12.3499251Z) No clue what's going on lol Edit: initial command now works. Removed |
What could be added to docs is |
hmm perhaps this is an issue with older rust versions, but still doesn't make much sense, since there's no call before Line 62 in 48d5d79
that sets this... |
I have replicated this, and I am still having the same issues, tried using different versions of Rust beta and nightly. Also installed from github and using OP commands. Workaround is to use WSL or MINGW64, but not ideal. |
this is so weird to me ... I guess we could make this not a hard error in windows as a workaround |
perhaps this is related rust-lang/rust#81408 |
@mattsse i removed the hook locally and is all good, so your fix does the trick |
I ran into the same issue but instead of a fresh windows 10 os, I'm running linux. You should be able to reproduce it using a VM or something. Compile from 67ef930 and move binaries to the new VM:
This happens in |
I tried by setting
it also ends up calling |
Do you think this could be the issue described in this comment @mattsse? |
Same thing happened to me using a FROM debian:bullseye-slim as foundry-install
RUN apt-get update -y && apt-get install -y curl git unzip wget
RUN curl -L https://foundry.paradigm.xyz | bash
RUN /root/.foundry/bin/foundryup
RUN cp -r /root/.foundry/bin/* /usr/local/bin
FROM debian:bookworm-slim
# RUN apt-get update -y && apt-get install -y git # solution
COPY --from=foundry-install /usr/local/bin /usr/local/bin $ root@status:/# forge --version
bash: forge: command not found
$ root@status:/# cast --version
Error: cannot install provided ErrorHook, a hook has already been installed
Location:
cli/src/handler.rs:70:13
$ anvil
# works as expected |
Thanks, this works on Alpine too. Strange error message but it makes sense since I guess git is used to search for the foundry.toml |
This issue is not letting me use the tool in an airgapped computer. It is a pity since the tool is really good. I downloaded Nightly (2023-10-19) and got: Location: OS: Ubuntu 22.04.03 LTS out of the bot |
After using rustup and the following cmd >
when trying cmd >
I get :
Error: cannot install provided ErrorHook, a hook has already been installed
Location:
cli\src\handler.rs:62:9
The text was updated successfully, but these errors were encountered: