Closed David-Stephenson closed 2 years ago
@DucksDont this sounds like a bug, i will check it this week, thanks for the report
Hello @DucksDont , i just added a fix for another task but that might fixed this too i wonder if you could try it by install it like this npm install --save hgouveia/node-downloader-helper#dev
, and let me know if works properly before i merge to master, also keep in mind the dl.start()
return a promise, so i also suggest to add dl.start().catch( err => {} );
When I install the module and run my project I get the error Error: Cannot find module '/home/ducksdont/Documents/Code/downloader/node_modules/node-downloader-helper/dist/index.js'. Please verify that the package.json has a valid "main" entry
.
Yeah, the command doesn't really work...
You need to clone the repo (git clone https://github.com/hgouveia/node-downloader-helper
) into your node_modules
folder, and then inside checkout the dev
branch, run npm i
and finally npm run build
. Then it should work :)
After installing the dev branch my project is still crashing. It also still crashes when I put dl.start().catch((err) => {});
After installing the dev branch my project is still crashing.
Still with the "Cannot find Module" error?
No, It's crashing with the original error.
@DucksDont is the error
event working now for you?, is the catch
also showing something?, could you provide more information, like node version, if you are using electron, which specific version, etc, probably a snippet of the code how are you using it, for me i dont see any reason for making your app to crash
Hello @DucksDont i just did a new fix, could you try once again?
It's still crashing. I'm running node v16.7.0. I am running an express server that accepts post requests and will download the file from the URL provided in the post request.
I tried testing node-download-help in a new project and I get a different error.
Error: Response status was 500
at ClientRequest.<anonymous> (/home/ducksdont/Desktop/node tester/node_modules/node-downloader-helper/dist/index.js:1:7153)
at Object.onceWrapper (node:events:514:26)
at ClientRequest.emit (node:events:394:28)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:621:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
at TLSSocket.socketOnData (node:_http_client:487:22)
at TLSSocket.emit (node:events:394:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10) {
status: 500,
body: ''
}
Error: Response status was 500
at ClientRequest.<anonymous> (/home/ducksdont/Desktop/node tester/node_modules/node-downloader-helper/dist/index.js:1:7153)
at Object.onceWrapper (node:events:514:26)
at ClientRequest.emit (node:events:394:28)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:621:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
at TLSSocket.socketOnData (node:_http_client:487:22)
at TLSSocket.emit (node:events:394:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10) {
status: 500,
body: ''
}
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:220:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
Here is my code:
const { DownloaderHelper } = require('node-downloader-helper');
const dl = new DownloaderHelper('https://me.me/market?s=pop', __dirname);
dl.on('end', () => console.log('Download Completed'))
dl.on("error", (error) => {
console.log(error);
});
dl.start().catch((error) => {
console.log(error);
});
If you're using Node 16, this might be related to #62
Hello @DucksDont added new change, could you check once more?
It's still crashing for me.
Error: Response status was 500
at ClientRequest.<anonymous> (/home/ducksdont/Desktop/testing/node_modules/node-downloader-helper/dist/index.js:1:6952)
at Object.onceWrapper (node:events:514:26)
at ClientRequest.emit (node:events:394:28)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:621:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
at TLSSocket.socketOnData (node:_http_client:487:22)
at TLSSocket.emit (node:events:394:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10) {
status: 500,
body: ''
}
Error: Response status was 500
at ClientRequest.<anonymous> (/home/ducksdont/Desktop/testing/node_modules/node-downloader-helper/dist/index.js:1:6952)
at Object.onceWrapper (node:events:514:26)
at ClientRequest.emit (node:events:394:28)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:621:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
at TLSSocket.socketOnData (node:_http_client:487:22)
at TLSSocket.emit (node:events:394:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10) {
status: 500,
body: ''
}
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:220:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
The catch on dl.start() catches one error but then it crashes.
.catch((error) => {
console.log(error);
});
The crashing error:
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:220:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
@DucksDont could you provide us some files with both your client code (using node-downloader-helper
) and your express server, so we can test it a bit better? :)
I'm still not totally sure what is going on 🤔
I'm currently testing on a test project. I sent the code in an earlier post.
Here is my testing project with the dev branch of the module installed. https://i.horizon.pics/OUbfR6M03m
@DucksDont i am really puzzle in here, i just checked in node 16.7.0 in both windows/linux (ubuntu focal), but i cant get this error
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:220:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
this is my output, that is expected
are you using MacOS?
I'm on Ubuntu 20.04
@DucksDont added new attempt, lets see if this finally fixes it, could you try once again?
Could you please send me the code you are using to test? Including the compiled node module.
@DucksDont the code was just create a dowload helper object and download a file nothing special, i published to npm v1.0.19, let me know if working
With v1.0.19
and dl.start().catch( err => {} );
it works now.
Thanks !
My piece of code :
const dl = new DownloaderHelper(`https://docs.google.com/spreadsheets/d/${docId}/export?format=xlsx`, folderToDl);
return new Promise((resolve, reject) => {
dl.on("end", (info: DownloadEndedStats) => {
....
});
dl.on("error", (e: ErrorStats) => {
this.log.error(`Fail to load spreadsheet`, e);
reject(e);
});
dl.start().catch((e) => reject(e) );
});
dl.start().catch((e) => reject(e) );
Can this be added to the docs? I got bit by this yesterday and spent most of the day trying to debug it before I found this thread.
Thanks.
Hello, When I attempt to download a file that doesn't exist I get the error
Error: Response status was 404 \n at ClientRequest.<anonymous>
and then the project crashes. I have the dl.on("error",) code. But it doesn't seem to be doing anything.I'm not sure if I'm doing something wrong.