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

htmlparser error in simple.js #4

Closed
masanzsa opened this issue Apr 7, 2017 · 3 comments
Closed

htmlparser error in simple.js #4

masanzsa opened this issue Apr 7, 2017 · 3 comments

Comments

@masanzsa
Copy link

masanzsa commented Apr 7, 2017

Tried to execute a simple sample, after following the advice on the issue posted by staminna and I am stuck here:

$ node simple.js --url=http://www.extractwidget.com/nodejs/test/testcastorama.html       
htmlparser
/home/globallink/simple.js:12
    var url = URL.parse(args.url);
                        ^

ReferenceError: args is not defined
    at Object.<anonymous> (/home/globallink/simple.js:12:25)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:393:7)
    at startup (bootstrap_node.js:150:9)
    at bootstrap_node.js:508:3

so far my html parser is module is installed correctly among other needed dependencies.

Local Modules

/home/localuser
├── args@2.4.1
├── bootstrap@3.3.7
├── cookies@0.7.0
├── fs@0.0.1-security
├── htmlparser@1.7.7
├── imagemagick@0.1.3
├── node-dom@0.1.0
├── request@2.81.0
├── tav@0.1.0
└── url@0.11.0

Global Modules

/usr/lib
├── args@2.4.1
├── bootstrap@3.3.7
├── cookies@0.7.0
├── fs@0.0.1-security
├── htmlparser@1.7.7
├── imagemagick@0.1.3
├── node-dom@0.1.0
├── nodebot@0.1.71
├── npm@3.10.10
├── npm-install-all@1.1.21
├── request@2.81.0
├── tav@0.1.0
└── url@0.11.0

Could you please help me with this one?

Thanks!

Mariano

@masanzsa
Copy link
Author

masanzsa commented Apr 7, 2017

changed the header of simple.js to this:

    var request = require('request'),
        dom = require('node-dom').dom,
        fs = require('fs'),
        parse = require ('parse'),
        args = require('args'),
        URL = require('url');

Then installed parse module form npm.
Now the error I am getting is this:

htmlparser
url.js:88
    throw new TypeError('Parameter "url" must be a string, not ' + typeof url);
    ^

TypeError: Parameter "url" must be a string, not undefined
    at Url.parse (url.js:88:11)
    at Object.urlParse [as parse] (url.js:82:5)
    at Object.<anonymous> (/home/globallink/simple.js:14:19)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:393:7)

@masanzsa masanzsa closed this as completed Apr 7, 2017
@masanzsa
Copy link
Author

masanzsa commented Apr 7, 2017

there are typos and missing header declarations in the 3 examples simple.js, medium.js and complete.js

will try to post corrected versions as soon as I can

@Ayms
Copy link
Owner

Ayms commented Apr 9, 2017

Thanks, I think the other modules have changed a bit

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

2 participants