Nativescript-angular: JS ERROR Error: Could not find module 'parse5/index'

Created on 12 Oct 2016  路  5Comments  路  Source: NativeScript/nativescript-angular

file:///app/tns_modules/nativescript-angular/parse5_adapter.js:8:21: JS ERROR Error: Could not find module 'parse5/index'. Computed path '/Users/nathan/Library/Developer/CoreSimulator/Devices/50661F53-A3AF-4858-AB9E-DFD7D9F88746/data/Containers/Bundle/Application/BDD7DED0-35B0-435A-957F-0EC02B12C188/nativescript.app/app/tns_modules/parse5/index'.
Oct 11 23:20:14 Mac com.apple.CoreSimulator.SimDevice.50661F53-A3AF-4858-AB9E-DFD7D9F88746.launchd_sim87854: Service exited due to signal: Segmentation fault: 11

Appears to be caused by this commit: https://github.com/NativeScript/nativescript-angular/commit/5dd8306aa5b0a89520de2e176df6bf357a4fcfba

And this recent additional file:
https://github.com/NativeScript/nativescript-angular/commit/5dd8306aa5b0a89520de2e176df6bf357a4fcfba#diff-3e6434b3f26aa8b3ee32ec130604cadc

/cc @hdeshev @vakrilov

Most helpful comment

Well, I reproduced it while working on the 2.0.2 compatibility release. It's complicated...

  1. The NativeScript DOM adapter uses the Parse5DomAdapter that is a part of @angular/platform-server. It used to require [email protected]
  2. Since 2.0.2 @angular/platform-server upgraded their parse5 code and they now use [email protected]
  3. 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 @angular/platform-server 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.

All 5 comments

Also an issue with latest 1.0.1 tag.

It looks like the parse5 package didn't end up in your platforms/.../app/tns_modules folder, or you got a different version that doesn't ship an index submodule. I tried reproducing the problem on the default project template (tns create myapp --ng) with both node 6.x and node 4.x, and it seems to work fine on my end.

Do you have a project I can look at?

Thanks @hdeshev you could try latest master of advanced seed:
https://github.com/NathanWalker/angular-seed-advanced

npm i
npm run start.ios

To see the issue. You can find the package for the {N} app here:
https://github.com/NathanWalker/angular-seed-advanced/blob/master/nativescript/package.json

Well, I reproduced it while working on the 2.0.2 compatibility release. It's complicated...

  1. The NativeScript DOM adapter uses the Parse5DomAdapter that is a part of @angular/platform-server. It used to require [email protected]
  2. Since 2.0.2 @angular/platform-server upgraded their parse5 code and they now use [email protected]
  3. 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 @angular/platform-server 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.

Hi, i am also experiencing this issue. What do i need to do to fix this? npm installs nativescript-angular 1.1.3.. can i upgrade? many thanks!

Was this page helpful?
0 / 5 - 0 ratings