You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After some hours of digging, I found that it was because the completeLength did not have a valid number.
The artifact-installer module seemed to use node-progress to display download progress. It tries to read a content-length header from a response and uses it as a total amount of the file size. However, in some cases response.headers.get('content-length') returned null.
TL; DR
I found a problem which can be caused by some mirror servers(similar to this FAQ).
It would be nice if this module can handle
null
value ofcontent-length
header in a response.The full story
In the middle of installing
nodegui
, I received this error:After some hours of digging, I found that it was because the
completeLength
did not have a valid number.The
artifact-installer
module seemed to usenode-progress
to display download progress. It tries to read acontent-length
header from a response and uses it as a total amount of the file size. However, in some casesresponse.headers.get('content-length')
returnednull
.artifact-installer/src/downloader.ts
Line 31 in dc95c5e
There are at least one mirror server that does not allow the js code to read the
content-length
header.In my region,
http://download.qt.io
redirects tohttp://mirrors.sjtug.sjtu.edu.cn
. Below is acurl
output of fetching qt base from that mirror:It clearly gives the line
Content-Length: 27030533
. However when run inside js withnode-fetch
:The
Content-Length
header is missing.This is compared to the one in other mirrors: for example,
https://qt.mirror.constant.com
. It givesContent-Length
in both situations:curl
:node-fetch
It would be nice if this module can handle
null
content length.The text was updated successfully, but these errors were encountered: