example-helloworld
example-helloworld copied to clipboard
Connection refused error with solana-test-validator up and running in a separate pane
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.
Try using node 16 instead of 17 if you're on 17
https://github.com/solana-labs/example-helloworld/issues/375
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
Thanks for this. Ran into same issue as well.
Try using node 16 instead of 17 if you're on 17
#375
This solution worked for me. Thanks a lot!
I am with Mac m1 and tried 17 and it failed. But nvm use 16 worked.
Try using node 16 instead of 17 if you're on 17
#375
Solution worked for me. Much appreciated!
Can't seem to get it to work with any version sadly enough....
I am facing the same issue cant get it work with any version
For me work this:
- First install Solana from brew or with curl.
- Clone the repository of solana.
- git checkout v1.9.4.
-
cargo build --release --bin solana-test-validator
-
cd validator
-
./solana-test-validator