Skip to content

'document is not defined' in units-css/lib/utilities.js #898

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

Closed
lucaspenney opened this issue Mar 30, 2017 · 9 comments
Closed

'document is not defined' in units-css/lib/utilities.js #898

lucaspenney opened this issue Mar 30, 2017 · 9 comments
Labels

Comments

@lucaspenney
Copy link

It looks like commit #3d545056e2bb61b25f2d8bb1445c2e424a615163 that brought in units-css seems to break a fresh install for me, giving the following error:

ReferenceError: document is not defined
at /var/www/Project/node_modules/units-css/lib/utilities.js:114:43

I tried on multiple different node versions before realizing a recent commit was the issue - rolling back to the previous version seemed to fix it.

@chearon
Copy link
Collaborator

chearon commented Mar 30, 2017

Wow that's not good, there should be no references to document in canvas... Was it a specific type of unit you were using that triggered this like em?

@lucaspenney
Copy link
Author

I'm rendering CanvasJS server side so I'm not sure specifically where it fails without digging into it's code, but it looks like the units library is intended to only run in a browser. It looks like others experienced this and created an issue with the units library.

@LinusU
Copy link
Collaborator

LinusU commented Mar 30, 2017

Oh, this is not good... I'm currently on vacation and have very limited internet and time to devote to this...

Is it a speechify can unit that triggers it, it seems like the tests where working, maybe we missed something 🤔

@LinusU
Copy link
Collaborator

LinusU commented Apr 1, 2017

Hmm, it seems like this is only for the rem unit, I wonder how that unit worked before...

@chearon
Copy link
Collaborator

chearon commented Apr 5, 2017

The regex didn't even match rem, it would have had no effect on the context I think... could add a test for that and bring back the old behavior. #899 seems much worse but I haven't had a chance to try to reproduce it yet

@zbjornson
Copy link
Collaborator

The dependency that caused this was removed a few weeks ago. Are you still having this problem with 2.0.0-alpha.5?

@LinusU
Copy link
Collaborator

LinusU commented Sep 9, 2017

Hmm, this is probably still a problem in 1.x 🤔

If anyone wants to backport #944 to 1.x I'd be happy to merge it :)

@saschagehlich
Copy link
Contributor

@LinusU I'm having a similar issue with 1.6.7, units-css seems to do some DOM stuff:

/Users/saschagehlich/development/node/node-videorenderer/node_modules/units-css/lib/utilities.js:39
  parent.appendChild(element);
         ^

TypeError: Cannot read property 'appendChild' of undefined

I see that the units-css dependency has been removed lately, but 1.6.8 or 1.7 have not been released yet. Any ETA on the release? Current 1.6.7 is basically broken.

@zbjornson
Copy link
Collaborator

v1.6.8 was released on Dec 12. @saschagehlich let us know if you're still having issues after updating.

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

No branches or pull requests

5 participants