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

Rolling jsdom back to 6.* #172

Closed
wants to merge 1 commit into from
Closed

Rolling jsdom back to 6.* #172

wants to merge 1 commit into from

Conversation

sjlu
Copy link

@sjlu sjlu commented Feb 17, 2016

It look like in the most recent version 0.5.0, you guys are trying to patch jsdom. In their 7.* version, they no longer use cssstyle which causes errors when trying to load the MathJax module.

The Error

web-0 Error: Cannot find module 'cssstyle/lib/parsers.js'
web-0     at Function.Module._resolveFilename (module.js:326:15)
web-0     at Function.Module._load (module.js:277:25)
web-0     at Function._load (/usr/local/Cellar/nvm/0.30.1/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
web-0     at Module.require (module.js:354:17)
web-0     at require (internal/module.js:12:17)
web-0     at /Users/sjlu/Code/testable/node_modules/mathjax-node/lib/patch/jsdom.js:51:17
web-0     at Object.<anonymous> (/Users/sjlu/Code/testable/node_modules/mathjax-node/lib/patch/jsdom.js:94:3)

Installed modules for MathJax at 0.5.0

[email protected] node_modules/speech-rule-engine
├── [email protected]
├── [email protected]
└── [email protected] ([email protected])

[email protected] node_modules/yargs
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/tape
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/jsdom
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected]

[email protected] node_modules/mathjax

After rolling back jsdom

@pkra
Copy link
Contributor

pkra commented Feb 17, 2016

I'm afraid I don't see any problems with the current version (both on node 4.2.6 and 5.5.0). I also see cssstyle listed in both lists you posted.

Do you have a sample that causes a problem?

@sjlu
Copy link
Author

sjlu commented Feb 17, 2016

@pkra Sorry for the stupidity, cssstyle is installed as clearly shown in my pull request, lol.

Still experiencing this issue & debugging more. At first glance, I believe the statement where it tries differentiating between v4.X and v5.X node is incorrect.

https://github.com/mathjax/MathJax-node/blob/master/lib/patch/jsdom.js#L8

I'm using node v4.2.6 and npm 2.14.12

web-0 Error: Cannot find module 'cssstyle/lib/parsers.js'

This line I believe is the v5 structure?

@pkra
Copy link
Contributor

pkra commented Feb 17, 2016

As I wrote, I didn't have an issue on node 4.2.6; but perhaps it's an npm / version issue (I'll check later).

ping @dpvc (but that will take a while).

@sjlu
Copy link
Author

sjlu commented Feb 17, 2016

@pkra it looks like the npm version was an issue. Upgrading to 3.7.2 fixes this issue.

@sjlu sjlu closed this Feb 17, 2016
@pkra
Copy link
Contributor

pkra commented Feb 18, 2016

Thanks for the follow up. Good to hear you could identify the issue.

@sjlu
Copy link
Author

sjlu commented Feb 18, 2016

No prob, might be good to mention in the README that the npm verison that node 4.2.6 ships with does not work with MathJax-node

@dpvc
Copy link
Member

dpvc commented Feb 21, 2016

It is not actually the npm version that is the issue. It was a bug in mathjax-node itself. The mathjax-node package relies on jsdom, which in turn relies on cssstyle. It turns out that cssstyle has (had) some bugs that mathjax-node needs to work around, and so it tries to patch cssstyle internally when it is loaded. But the way that node and npm organize the dependencies changed between node versions 4 and 5, and so mathjax-node has to figure out which hierarchy is in use. It turns out that there is a bug in the code that does that, and it was looking in the wrong place, which caused the error you are seeing. (The bug is that the search is dependent on what the current directory is.)

@dpvc
Copy link
Member

dpvc commented Feb 21, 2016

The issue172 branch includes a patch for the problem.

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

Successfully merging this pull request may close these issues.

3 participants