What could cause “connect ETIMEDOUT” error when the URL is working in browser?

后端 未结 6 1439
深忆病人
深忆病人 2021-02-19 07:46

I train myslef with NodeJS and tried a simple GET call. Here is my code:

var http = require(\'http\');

var options = {
    host: \'www.boardgamegeek.com\',
             


        
6条回答
  •  情书的邮戳
    2021-02-19 08:32

    I was facing this issue on Ubuntu Server while maintaining a node instance on PM2. Basically after restarting the instance after taking the pull I was getting the same error on initial connection of mySQL inside the code.

    Error: connect ETIMEDOUT
    at Connection._handleConnectTimeout (/home/deam_server/node_modules/mysql/lib/Connection.js:419:13)
    at Object.onceWrapper (events.js:275:13)
    at Socket.emit (events.js:182:13)
    at Socket.EventEmitter.emit (domain.js:442:20)
    at Socket._onTimeout (net.js:447:8)
    at ontimeout (timers.js:427:11)
    at tryOnTimeout (timers.js:289:5)
    at listOnTimeout (timers.js:252:5)
    at Timer.processTimers (timers.js:212:10)
    

    Though the same code was running perfectly on my local machine. After that I used "df" command which helped me to realise that my root directory was 100% occupied. I allotted some memory to the root directory and the restarted the node instance and then it started working fine.

提交回复
热议问题