@types/jsdom package and had problems.npm install @types/jsdomthe error displaying on typescript compile is "jsdom/index.d.ts(10,28): error TS2307: Cannot find module 'parse5'.
I checked the jsdom dependencies and found all of the listings were correct.
I checked for the folder node_modules/parse5 and it _was installed properly_ when jsdom was installed.
At this point I wonder if there is some sort of problem with the version of parse5 depends on.
I noticed some had issues with Parse5 in Angular repositories, wondering if it is not related:
Well, I reproduced it while working on the 2.0.2 compatibility release. It's complicated...
The NativeScript DOM adapter uses the Parse5DomAdapter that is a part of . It used to require [email protected]
Since 2.0.2 upgraded their parse5 code and they now use [email protected]
nativescript-cli sees both package versions as a dependency and randomly decides which one to use. In this case it picks [email protected] and causes the crash.
I wanted to upgrade our fork of Parse5DomAdapter and make it use [email protected], but that did not work. Parse5 2.x uses node libraries (stream, etc) that are not available in NativeScript. I was already having nightmares about having to bundle parse 1.x and distribute it as a vendored package, when I figured out that we don't really need a depencency on anymore. When I removed that one from all package.json files, the crash went away.To summarize, this error will be fixed with the Angular 2.0.2 compatibility release. I'm working on it, and it will probably hit npm some time tomorrow.
https://github.com/NativeScript/nativescript-angular/issues/493
I tried to repro but couldn't. Do you mind posting a repro?
here is a sample project that is giving me the error:
https://github.com/djtorrey/testjsdom
You have moduleResolution set to classic in your tsconfig.json. Removing that option fixes it.
looks like that did it, thanks. I thought I added classic for some other reason but this seems to fix it.
Most helpful comment
You have
moduleResolutionset toclassicin yourtsconfig.json. Removing that option fixes it.