Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http-collect solution cannot be verified #54

Closed
jonniedarko opened this issue Dec 11, 2013 · 7 comments
Closed

http-collect solution cannot be verified #54

jonniedarko opened this issue Dec 11, 2013 · 7 comments

Comments

@jonniedarko
Copy link

When running the solution provided here I get the following output

Verifying "HTTP COLLECT"...

ACTUAL:   ""
EXPECTED: "123"

ACTUAL:   null
EXPECTED: "Flat out like a swag no worries as dry as a big smoke. 
Lets throw a fruit loop how as stands out like not my
bowl of rice. "

ACTUAL:   null
EXPECTED: ""

# FAIL

Your solution to HTTP COLLECT didn't match the expected output.
Try again!
@rvagg
Copy link
Contributor

rvagg commented Dec 11, 2013

looks like you might have a stale process running in the background, try killall node and try again. Also sudo npm install learnyounode -g to get the latest, I just published a new version that has an auto-kill thing in it that should (hopefully) stop this kind of thing.

@jonniedarko
Copy link
Author

I have no other node processes running and I rerun the npm install learnyounode -g and tried again, still with no success. Running in windows 7 if that makes any difference

@jonniedarko
Copy link
Author

I also seem to have the same Issue with the Juggling-async solution

@jonniedarko
Copy link
Author

I Think it may be an issue with the network proxy as I had the same issue running the following myself

http.get('http://www.google.com/index.html', function(res) {
  console.log("Got response: " + res.statusCode);
}).on('error', function(e) {
  console.log("Got error: " + e.message);
});

I had to change the above to the following where our company proxy is http://http.proxy.somewhere.com:1234:

http.get({ host: 'http.proxy.somewhere.com', path:'http://www.google.com/index.html', port: 1234}, function(res) {

  console.log("Got response: " + res.statusCode);
}).on('error', function(e) {
  console.log("Got error: " + e.message);
});

I realise this is probably not a bug, at least not with learnyounode (possibly more so with Node itself) but how might I get around it

@Flet
Copy link
Member

Flet commented Dec 11, 2013

Hi @jonniedarko,

It would not be a proxy issue as its not calling out anywhere when verifying.

The solution.js requires the npm module bl, which may not have been installed. When I try to run the solution without first installing bl, I get the same failure you describe above. After I install it, great success!

Try npm install bl in the same directory and verify again. This step is described nicely in the problem description for http collect.

You may run into issues with npm if you're behind a proxy. Run this command to set the proxy for npm:
npm config set proxy http://username:password@proxy.somewhere.com:80

@jonniedarko
Copy link
Author

Hi @Flet , looks like that was the Issue, I was pretty sure that I had installed bl globally thought, so not sure why that didn't work but I tried it with a local install and it solved my problem

@chiadt
Copy link

chiadt commented May 13, 2015

You try:

var http = require('http')
var bl = require('bl')

http.get(process.argv[2], function (response) {
  response.pipe(bl(function (err, data) {
    if (err)
      return console.error(err)
    data = data.toString()
    console.log(data.length)
    console.log(data)
  }))  
})

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

No branches or pull requests

4 participants