example-helloworld icon indicating copy to clipboard operation
example-helloworld copied to clipboard

Connection refused error with solana-test-validator up and running in a separate pane

Open 1776M opened this issue 3 years ago • 9 comments

Hi, I am sure this must be a simple thing but it has happened on two different ubuntu instances where I tried to run the example-helloworld app. I am sure there is something I am doing wrong.

I am using Ubuntu to try and get the example-helloworld up and running.

I have followed the steps to build and deploy the app, which has all worked fine in a terminal pane. I have also started a "solana-test-validator" in a separate terminal pane, together with "solana logs" in a third pane.

I have also ensured I have solana's web3.js installed. When I run the command "npm start" in the first pane I get the following error show below. The solana-test-validator process seems to get killed when I run "npm start". Is there a obvious fix for this, to stop it getting killed?


FetchError: request to http://localhost:8899/ failed, reason: connect ECONNREFUSED 127.0.0.1:8899 at ClientRequest. (/root/example-helloworld/node_modules/node-fetch/lib/index.js:1461:11) at ClientRequest.emit (node:events:390:28) at ClientRequest.emit (node:domain:475:12) at Socket.socketErrorListener (node:_http_client:447:9) at Socket.emit (node:events:390:28) at Socket.emit (node:domain:475:12) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { type: 'system', errno: 'ECONNREFUSED', code: 'ECONNREFUSED'

1776M avatar Dec 31 '21 12:12 1776M

Try using node 16 instead of 17 if you're on 17

https://github.com/solana-labs/example-helloworld/issues/375

qpwo avatar Jan 18 '22 00:01 qpwo

Ran into the same issue as what @1776M experienced. I was on node v17 and switching to node 16 works.

nvm use 17
> Now using node v17.3.0 (npm v8.3.0)
npm run start

> [email protected] start
> ts-node src/client/main.ts

Let's say hello to a Solana account...
FetchError: request to http://localhost:8899/ failed, reason: connect ECONNREFUSED ::1:8899
    at ClientRequest.<anonymous> (/Users/jacob/Repo/example-helloworld/node_modules/node-fetch/lib/index.js:1461:11)
    at ClientRequest.emit (node:events:390:28)
    at ClientRequest.emit (node:domain:475:12)
    at Socket.socketErrorListener (node:_http_client:442:9)
    at Socket.emit (node:events:390:28)
    at Socket.emit (node:domain:475:12)
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  type: 'system',
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED'
}

Switched to either node v16 or v14

nvm use 16
> Now using node v16.13.1 (npm v8.1.2)

> [email protected] start
> ts-node src/client/main.ts

Let's say hello to a Solana account...
Connection to cluster established: http://localhost:8899 { 'feature-set': 3258470607, 'solana-core': '1.9.4' }
Using account <ACCOUNT_ID> containing 499999999.1546446 SOL to pay for fees
Using program <PROGRAM_ID>
Saying hello to <PROGRAM_ID>
<PROGRAM_ID> has been greeted 4 time(s)
Success

jacobtyq avatar Jan 18 '22 18:01 jacobtyq

Thanks for this. Ran into same issue as well.

ericlau-solid avatar Jan 19 '22 20:01 ericlau-solid

Try using node 16 instead of 17 if you're on 17

#375

This solution worked for me. Thanks a lot!

iinstances avatar Jan 20 '22 06:01 iinstances

I am with Mac m1 and tried 17 and it failed. But nvm use 16 worked.

Kubikasz avatar Mar 16 '22 06:03 Kubikasz

Try using node 16 instead of 17 if you're on 17

#375

Solution worked for me. Much appreciated!

turanzv avatar May 16 '22 06:05 turanzv

Can't seem to get it to work with any version sadly enough....

alanrichards86 avatar Nov 16 '22 20:11 alanrichards86

I am facing the same issue cant get it work with any version

0xPratik avatar Jan 19 '23 08:01 0xPratik

For me work this:

  1. First install Solana from brew or with curl.
  2. Clone the repository of solana.
  3. git checkout v1.9.4.
  4. cargo build --release --bin solana-test-validator
  5. cd validator
  6. ./solana-test-validator

mariesco avatar Jan 26 '23 20:01 mariesco