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

0.9.13 fails: Object #<Object> has no method 'parse' #132

Closed
joeyparrish opened this issue May 2, 2016 · 14 comments
Closed

0.9.13 fails: Object #<Object> has no method 'parse' #132

joeyparrish opened this issue May 2, 2016 · 14 comments

Comments

@joeyparrish
Copy link
Contributor

I'm running ./node_modules/.bin/htmlhint demo/index.html

No problem with the same .htmlhintrc in 0.9.12.

.htmlhintrc is

{
    "alt-require": true,
    "attr-lowercase": false,
    "attr-no-duplication": true,
    "attr-unsafe-chars": true,
    "attr-value-double-quotes": true,
    "attr-value-not-empty": false,
    "csslint": false,
    "doctype-first": true,
    "doctype-html5": true,
    "head-script-disabled": false,
    "href-abs-or-rel": false,
    "id-class-ad-disabled": true,
    "id-class-value": true,
    "id-unique": true,
    "inline-script-disabled": true,
    "inline-style-disabled": true,
    "jshint": false,
    "space-tab-mixed-disabled": true,
    "spec-char-escape": true,
    "src-not-empty": true,
    "style-disabled": true,
    "tag-pair": true,
    "tag-self-close": false,
    "tagname-lowercase": true,
    "title-require": true
}

Output is

/home/joeyparrish/hacking/shaka/js/node_modules/htmlhint/bin/formatter.js:30
        var fileInfo = path.parse(file);
                            ^
TypeError: Object #<Object> has no method 'parse'
    at /home/joeyparrish/hacking/shaka/js/node_modules/htmlhint/bin/formatter.js:30:29
    at Array.forEach (native)
    at loadFormatters (/usr/local/google/home/joeyparrish/hacking/shaka/js/node_modules/htmlhint/bin/formatter.js:29:14)
    at Object.<anonymous> (/usr/local/google/home/joeyparrish/hacking/shaka/js/node_modules/htmlhint/bin/formatter.js:11:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)

@yaniswang
Copy link
Contributor

yaniswang commented May 2, 2016

What's your node version?

It is no make sense.

path object is require('path');

@joeyparrish
Copy link
Contributor Author

node -v says v0.10.25

@yaniswang
Copy link
Contributor

Can you debug the code in your node?

Found why require('path') have no parse method.

@joeyparrish
Copy link
Contributor Author

This is what path looks like:

path { resolve: [Function],
  normalize: [Function],
  join: [Function],
  relative: [Function],
  sep: '/',
  delimiter: ':',
  dirname: [Function],
  basename: [Function],
  extname: [Function],
  exists: [Function: deprecated],
  existsSync: [Function: deprecated],
  _makeLong: [Function] }

I will keep digging.

@joeyparrish
Copy link
Contributor Author

It appears this was introduced in v0.12. Do you intend to support v0.10? That is the version shipped with Ubuntu 14 (LTS) and 15.

If you only support v0.12, you should add an "engines" section to your package.json to make it clear that your package now requires this.

@joeyparrish
Copy link
Contributor Author

You may also be able to depend on this polyfill for path.parse: https://www.npmjs.com/package/path-parse

@joeyparrish
Copy link
Contributor Author

I can confirm that along with a dependence on 'path-parse', this change in formatter.js fixes it for me:

var path = require('path');
var events = require('events');
var glob = require('glob');
path.parse = path.parse || require('path-parse');

shaka-bot pushed a commit to shaka-project/shaka-player that referenced this issue May 2, 2016
The latest htmlhint (v0.9.13) does not work with node v0.10, which
is what Ubuntu 14 LTS comes with.

See htmlhint/HTMLHint#132 for more details.

Change-Id: Ib148164828317ec56fa32ce3a7b21ae4061333f6
@yaniswang
Copy link
Contributor

No way to upgrade node version?

@joeyparrish
Copy link
Contributor Author

I can upgrade node on my workstation, but that doesn't really help if your package doesn't declare its dependency on node v0.12. People can still clone my project, which depends on htmlhint, try to build it, then get a confusing failure from htmlhint. So until this is fixed, I had to set my project to require v0.9.12 of htmlhint.

Either declaring a dependence on node v0.12 or using the path-parse polyfill would help, in my opinion. I would prefer the polyfill, because it means htmlhint running in more places. Either fix would be technically correct, though.

@joeyparrish
Copy link
Contributor Author

Thank you very much!

@yaniswang
Copy link
Contributor

Wait next release.

@joeyparrish
Copy link
Contributor Author

@yaniswang, any idea when the next release will be?

@joeyparrish
Copy link
Contributor Author

@yaniswang, will there be a new release any time soon?

@joeyparrish
Copy link
Contributor Author

Still no new release? 0.9.12 was missing a feature I needed and 0.9.13 broke support for node v0.10. You've already fixed all the issues I care about. Now I just need 0.9.14 released on npm so I can depend on it and use it in my project.

shaka-bot pushed a commit to shaka-project/shaka-player that referenced this issue Jan 18, 2017
This is better than ignoring all camelcase.

Introduced by htmlhint/HTMLHint#121 and released in 0.9.13.

However, 0.9.13 is incompatible with node v0.10.  This was fixed
in htmlhint/HTMLHint#132, but there has not been a release since
(in 8 months).

Therefore we are pinning to today's git version instead of a release.
This gets us the camelcase whitelisting feature and doesn't break with
node v0.10.

Change-Id: I1e3b6c0c96ef24662b46497b1a601bde0dae5704
joeyparrish added a commit to shaka-project/shaka-player that referenced this issue Jan 19, 2017
This is better than ignoring all camelcase.

Introduced by htmlhint/HTMLHint#121 and released in 0.9.13.

However, 0.9.13 is incompatible with node v0.10.  This was fixed
in htmlhint/HTMLHint#132, but there has not been a release since
(in 8 months).

Therefore we are pinning to today's git version instead of a release.
This gets us the camelcase whitelisting feature and doesn't break with
node v0.10.

Change-Id: I1e3b6c0c96ef24662b46497b1a601bde0dae5704
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