Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Error with node >= 6.0.0 and < 7.7.0 #840

Closed
the-owl opened this issue Aug 27, 2018 · 2 comments · Fixed by #847
Closed

Error with node >= 6.0.0 and < 7.7.0 #840

the-owl opened this issue Aug 27, 2018 · 2 comments · Fixed by #847

Comments

@the-owl
Copy link
Contributor

the-owl commented Aug 27, 2018

js-ipfs-api declares support of nodejs >= 6.0.0 in package.json. But in fact it does not support versions below 7.7.0.

My node version is 6.10, and I get this when calling ipfs.refs.local():

TypeError: res.req.getHeaders is not a function at: TypeError: res.req.getHeaders is not a function
    at ClientRequest.<anonymous> (/var/www/something/node_modules/ipfs-api/src/utils/send-request.js:41:38)
    at ClientRequest.g (events.js:291:16)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:474:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
    at Socket.socketOnData (_http_client.js:363:20)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:548:20)

Support for ClientRequest.getHeaders() was added only in 7.7.0: https://nodejs.org/api/http.html#http_response_getheaders

engines.node field in package.json should probably be raised to >=7.7.0 to avoid confusion.

@alanshaw
Copy link
Contributor

Yes, this and also the README needs to be updated here to say the same as js-ipfs:

We support both the Current and Active LTS versions of Node.js. Please see nodejs.org for what these currently are.

Would you be willing to send a PR to fix this @the-owl?

@the-owl
Copy link
Contributor Author

the-owl commented Aug 29, 2018

@alanshaw yes, I'll send a PR soon

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants