I want to write a program to show some npm packages, there's example code:
const https = require('node:https')
const url = '
const req = https.request(url, res => { console.log('statusCode:', res.statusCode) console.log('headers:', res.headers) res.on('data', d => { process.stdout.write(d) })
})
req.on('error', e => { console.error(e)
})
req.end()But get error:
Error: connect ETIMEDOUT 104.16.23.35:443 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4039, code: 'ETIMEDOUT', syscall: 'connect', address: '104.16.23.35', port: 443
}At first, I think about it is due to the problem of my own network. But when I input the address in browser, it works just well. It makes me very confused, why it works fun in browser but not good with nodejs?
Node version: 16.15.0
Npm version: 8.5.5
System: windows10
No proxy