Skip to content

Error: CONNECTION ERROR: Couldn't connect to node http://localhost:8545. #780

@AntennaeVY

Description

@AntennaeVY

I'm getting the following error when trying to deploy the contracts with
yarn deploy:contracts

This is the error when running yarn deploy:contracts

yarn run v1.22.22
$ yarn compile:contracts && node --experimental-json-modules client/scripts/deploy_contracts.mjs
$ cd contracts && forge build
[⠒] Compiling...
No files changed, compilation skipped
(node:6619) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
y<< NETWORK: local >>
connecting web3 to 'http://localhost:8545'...
(1) Will deploy Ethernaut.sol!
(2) Will deploy Statistics.sol!
(3) Will deploy ProxyAdmin.sol!
(4) Will deploy ProxyStats.sol!
(5) Will deploy InstanceFactory.sol (Hello Ethernaut)
(6) Will deploy FallbackFactory.sol (Fallback)
(7) Will deploy FalloutFactory.sol (Fallout)
(8) Will deploy CoinFlipFactory.sol (Coin Flip)
(9) Will deploy TelephoneFactory.sol (Telephone)
(10) Will deploy TokenFactory.sol (Token)
(11) Will deploy DelegationFactory.sol (Delegation)
(12) Will deploy ForceFactory.sol (Force)
(13) Will deploy VaultFactory.sol (Vault)
(14) Will deploy KingFactory.sol (King)
(15) Will deploy ReentranceFactory.sol (Re-entrancy)
(16) Will deploy ElevatorFactory.sol (Elevator)
(17) Will deploy PrivacyFactory.sol (Privacy)
(18) Will deploy GatekeeperOneFactory.sol (Gatekeeper One)
(19) Will deploy GatekeeperTwoFactory.sol (Gatekeeper Two)
(20) Will deploy NaughtCoinFactory.sol (Naught Coin)
(21) Will deploy PreservationFactory.sol (Preservation)
(22) Will deploy RecoveryFactory.sol (Recovery)
(23) Will deploy MagicNumFactory.sol (MagicNumber)
(24) Will deploy AlienCodexFactory.sol (Alien Codex)
(25) Will deploy DenialFactory.sol (Denial)
(26) Will deploy ShopFactory.sol (Shop)
(27) Will deploy DexFactory.sol (Dex)
(28) Will deploy DexTwoFactory.sol (Dex Two)
(29) Will deploy PuzzleWalletFactory.sol (Puzzle Wallet)
(30) Will deploy MotorbikeFactory.sol (Motorbike)
(31) Will deploy DoubleEntryPointFactory.sol (DoubleEntryPoint)
(32) Will deploy GoodSamaritanFactory.sol (Good Samaritan)
(33) Will deploy GatekeeperThreeFactory.sol (Gatekeeper Three)
(34) Will deploy SwitchFactory.sol (Switch)
(35) Will deploy HigherOrderFactory.sol (HigherOrder)
(36) Will deploy StakeFactory.sol (Stake)
(37) Will deploy ImpersonatorFactory.sol (Impersonator)
(38) Will deploy MagicAnimalCarouselFactory.sol (Magic Animal Carousel)
prompt: Confirm deployment? (y/n):  y
INSIDE
/home/user/Documents/ethernaut/client/node_modules/web3-core-helpers/lib/errors.js:66
        const error = new Error(msg);
                      ^

Error: CONNECTION ERROR: Couldn't connect to node http://localhost:8545.
    at Object.ConnectionError (/home/user/Documents/ethernaut/client/node_modules/web3-core-helpers/lib/errors.js:66:23)
    at Object.InvalidConnection (/home/user/Documents/ethernaut/client/node_modules/web3-core-helpers/lib/errors.js:36:21)
    at HttpProvider.failed (/home/user/Documents/ethernaut/client/node_modules/web3-providers-http/lib/index.js:139:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.19.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Yes, I have executed yarn network previously with the following output:

yarn run v1.22.22
$ cd contracts && anvil --block-time 1 --auto-impersonate


                             _   _
                            (_) | |
      __ _   _ __   __   __  _  | |
     / _` | | '_ \  \ \ / / | | | |
    | (_| | | | | |  \ V /  | | | |
     \__,_| |_| |_|   \_/   |_| |_|

    1.0.0-stable (e144b82070 2025-02-13T20:03:31.026474817Z)
    https://github.com/foundry-rs/foundry

Available Accounts
==================

(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000.000000000000000000 ETH)
(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000.000000000000000000 ETH)
(2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000.000000000000000000 ETH)
(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000.000000000000000000 ETH)
(4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000.000000000000000000 ETH)
(5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (10000.000000000000000000 ETH)
(6) 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (10000.000000000000000000 ETH)
(7) 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (10000.000000000000000000 ETH)
(8) 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (10000.000000000000000000 ETH)
(9) 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 (10000.000000000000000000 ETH)

Private Keys
==================

(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
(1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
(2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
(3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6
(4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
(5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba
(6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e
(7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356
(8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
(9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6

Wallet
==================
Mnemonic:          test test test test test test test test test test test junk
Derivation path:   m/44'/60'/0'/0/


Chain ID
==================

31337

Base Fee
==================

1000000000

Gas Limit
==================

30000000

Genesis Timestamp
==================

1742864971

Listening on 127.0.0.1:8545

    Block Number: 1
    Block Hash: 0xb99d4528040dccd9874b3746d91a52e11916486842d45a02df635889ec4a6dbc
    Block Time: "Tue, 25 Mar 2025 01:09:32 +0000"


    Block Number: 2
    Block Hash: 0x2ff8c071cfd75425f59576cfa606c9631209f1313b5d8a626bc3dd3ef938554d
    Block Time: "Tue, 25 Mar 2025 01:09:33 +0000"


    Block Number: 3
    Block Hash: 0x02221f7e7941d8e9cc3c88e7f9c58094052deffa1fa078972195dd22663a7e91
    Block Time: "Tue, 25 Mar 2025 01:09:34 +0000"


    Block Number: 4
    Block Hash: 0x32054c247e76f1542040e7f3320dca295007202f6d63ba1652523ec8e9e33827
    Block Time: "Tue, 25 Mar 2025 01:09:35 +0000"


    Block Number: 5
    Block Hash: 0xa3c39aa96214344e54c55c0258970579f8cdfcc9910ac5b71ec64e235ef4f21a
    Block Time: "Tue, 25 Mar 2025 01:09:36 +0000"


    Block Number: 6
    Block Hash: 0xa39edae5699bcfa13abc03b03e402cfa786b3f4368bc0ae22e12714325888401
    Block Time: "Tue, 25 Mar 2025 01:09:37 +0000"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions