Browserify of jsdom fails: Error: Cannot find module './jsdom/living/generated/utils.js' from '/home/user/Downloads/jsdom-15.2.0/lib'

135 views
Skip to first unread message

Hugo Ferreira

unread,
Oct 21, 2019, 9:55:39 AM10/21/19
to jsdom
Hi,

Following up on a previous question I made, I am trying to "browserify" jsdom.
I get an error that  './jsdom/living/generated/utils.js' is missing.
I downloaded the latest version and checked the master branch and in fact this file is missing.
A search through the repository aslo shows that there are many other "generated" files that are required. 
I assume these are generated via some IDL.

Can anyone point out docos or instruction on how to generate these files?

TIA
HF

Domenic Denicola

unread,
Oct 21, 2019, 11:34:13 AM10/21/19
to js...@googlegroups.com
The best approach is to get jsdom from npm, instead of GitHub.

Failing that, you can run "npm run prepublish" to get something similar to the published npm package when working locally.



From: Hugo Ferreira <hugo6f...@gmail.com>
Sent: Monday, October 21, 2019 09:55
To: jsdom
Subject: Browserify of jsdom fails: Error: Cannot find module './jsdom/living/generated/utils.js' from '/home/user/Downloads/jsdom-15.2.0/lib'

--
You received this message because you are subscribed to the Google Groups "jsdom" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsdom+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsdom/83a57cac-2e76-43bc-9385-d48330b2f2ba%40googlegroups.com.

Hugo Ferreira

unread,
Oct 21, 2019, 12:48:16 PM10/21/19
to jsdom

Just an update - I finally was able to "browserify ". I can load the bundle but have an exception - "window not defined".
Because I have no yarn installed I needed to change the line:


to use `file` instead of `link`.

The next step was to run:


and finally browserify with:

browserify api.js > jsdom_bundle.js

Final final note: make sure you update the dev dependencies.

HTHs anyone in the same situation.

Hugo Ferreira

unread,
Oct 21, 2019, 1:19:35 PM10/21/19
to jsdom
Hi Domenic

Apologies for not seeing your response.

First issue is that I need the "bundle.js" because I am loading t into the GraalJS engine, hence the local attempt.
Second, I tried the "npm run prepublish" locally and that failed with a " verbose stack Error: missing script: prepublish"
Finally I execute "npm run test-browser-worker" and all tests are green.

I also tested the "browserify -r jsdom -o jsdom_bundle.js" suggested in one of the issues but that fails
because no jsdom is found.

With the bundle I generated I get the following error:

Exception in thread "main" ReferenceError: window is not defined
    at <js> 549(mdocs/src/mdocs/jsdom_bundle.js:97897:2976181-2976186)
    at <js> o(mdocs/src/mdocs/jsdom_bundle.js:1:256-343)

Maybe I am browserifying incorrectly. I assume that the "test-browser-worker" generates the bundle.
Is this true? If so, were does it place this. I am looking and cannot find it.

TIA,


On Monday, 21 October 2019 16:34:13 UTC+1, Domenic Denicola wrote:
The best approach is to get jsdom from npm, instead of GitHub.

Failing that, you can run "npm run prepublish" to get something similar to the published npm package when working locally.



From: Hugo Ferreira <hugo6f...@gmail.com>
Sent: Monday, October 21, 2019 09:55
To: jsdom
Subject: Browserify of jsdom fails: Error: Cannot find module './jsdom/living/generated/utils.js' from '/home/user/Downloads/jsdom-15.2.0/lib'

Hi,

Following up on a previous question I made, I am trying to "browserify" jsdom.
I get an error that  './jsdom/living/generated/utils.js' is missing.
I downloaded the latest version and checked the master branch and in fact this file is missing.
A search through the repository aslo shows that there are many other "generated" files that are required. 
I assume these are generated via some IDL.

Can anyone point out docos or instruction on how to generate these files?

TIA
HF

--
You received this message because you are subscribed to the Google Groups "jsdom" group.
To unsubscribe from this group and stop receiving emails from it, send an email to js...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages