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

Fix 2.1.1 _private_ import issues #606

Closed
2 tasks done
MarkPieszak opened this issue Oct 23, 2016 · 27 comments
Closed
2 tasks done

Fix 2.1.1 _private_ import issues #606

MarkPieszak opened this issue Oct 23, 2016 · 27 comments

Comments

@MarkPieszak
Copy link
Member

MarkPieszak commented Oct 23, 2016

  • I'm submitting a ...
  • bug report
  • What modules are related to this Issue?
  • platform-node

In the latest Core/Compiler upgrades to 2.1.1, compiler-private & core-private have changed a few things Universal uses.

__compiler_private__ looks to of been removed from @angular/compiler.

SelectorMatcher & CssSelector (needed for Universal), seem to be public now.

Also _ViewUtils seems to be missing / removed from __core_private__
It looks like it was renamed to view_utils ?

Seems to fix it:

import {
  SelectorMatcher as SelectorMatcher211, 
  CssSelector as CssSelector211 } from '@angular/compiler';

let SelectorMatcher;
let CssSelector;

if (SelectorMatcher211 && CssSelector211) {
  SelectorMatcher = SelectorMatcher211;
  CssSelector = CssSelector211;
} else {
  const _compiler_private_  = require('@angular/compiler').__compiler_private__;
  SelectorMatcher = _compiler_private_.SelectorMatcher;
  CssSelector = _compiler_private_.CssSelector;
}

ViewUtils -> view_utils can be handled in a similar way.

@obenjiro
Copy link

Can we merge this? Or is there any issues with this PR?

@stanbe
Copy link

stanbe commented Nov 28, 2016

Any news on this issue?

@MarkPieszak
Copy link
Member Author

I'll talk to Pat about it today and let you guys know @stanbe @AiBoy.
We have a nice workaround file for now you can use (and import at the top of your browser/node modules) for the time being as well. (https://github.com/angular/universal-starter/tree/master/src - you can see the workaround files in here)

@0radek
Copy link

0radek commented Dec 13, 2016

Hi. Is this issue fixed? I am still getting this error, using angular2-universal version ~2.1.0-rc.1

@0radek
Copy link

0radek commented Dec 13, 2016

@MarkPieszak I followed the link you posted and added those files to my project, and then imported the appropriate ones into my client.ts and server.ts

Unfortunately I'm still getting the same error. Here are my versions, if that is any help too:

    "@angular/common": "~2.1.2",
    "@angular/compiler": "~2.1.2",
    "@angular/core": "~2.1.2",
    "@angular/forms": "~2.1.2",
    "@angular/http": "~2.1.2",
    "@angular/platform-browser": "~2.1.2",
    "@angular/platform-browser-dynamic": "~2.1.2",
    "@angular/platform-server": "~2.1.2",
    "angular2-express-engine": "~2.1.0-rc.1",
    "angular2-platform-node": "~2.1.0-rc.1",
    "angular2-universal": "~2.1.0-rc.1",
    "angular2-universal-polyfills": "~2.1.0-rc.1",

@MarkPieszak
Copy link
Member Author

You have it setup similar to how the starters have it? Included at the top of each of those files? @ScaryWolfMan

@0radek
Copy link

0radek commented Dec 14, 2016

@MarkPieszak Yep! :(

@colltoaction
Copy link

colltoaction commented Dec 14, 2016 via email

@0radek
Copy link

0radek commented Dec 14, 2016

I'm a newibe to universal but it seems like a pretty daunting task trying to manage all the various angular projects and making sure everything works. :o

@stanbe
Copy link

stanbe commented Dec 14, 2016

This error is rather annoying and the workaround is by definition just a workaround, not really satisfying. Is there still an issue with the pull request? @MarkPieszak @AiBoy

@obenjiro
Copy link

@stanbe I'm not a maintainer :/ so I can't do anything about it.

And yes, we have Angular 2.3 already, but I still can't update Angular-Universal. This is sad.

@MarkPieszak
Copy link
Member Author

Let me make sure the workaround still works for the latest Angular release and I'll talk to @gdi2290 about it, see if it's possible to squeeze this in there!
Apologies guys!

@0radek
Copy link

0radek commented Dec 15, 2016

@MarkPieszak I've reverted to 2.10 and I'm able to run my project without any issues at the moment.

@fdambrosio
Copy link

how can we build with universal? We're started using angular2-webpack-starter

@MarkPieszak
Copy link
Member Author

Check out the universal node starter to see what you need to add to the webpack-starter, check out the documentation.md file here as well that talks about the necessary files. @fdambrosio

@fdambrosio
Copy link

thanks @MarkPieszak we have "Call to Node module failed with error: TypeError: Cannot read property 'SelectorMatcher' of undefined" message error

@MarkPieszak
Copy link
Member Author

MarkPieszak commented Dec 19, 2016

If you're using the workaround I think you can't use Angular 2.3 as some other things changed. Can you take it down to 2.2 and see if it works?
As we move some Core things from Universal into AngularCore itself, it'll help alleviate problems like this from happening!

@0radek
Copy link

0radek commented Dec 19, 2016

@MarkPieszak I was having the same issue, but I'm now using angular 2.1.0 and angular-universal 2.0.11. no longer getting any issues :(

@dimonzav
Copy link

Workarounds from universal-starter repository is working well with Angular 2.4.1!

@MarkPieszak
Copy link
Member Author

Oh that's great news 👍 haven't been able to check on holiday this week. @dimonzav

@szykov
Copy link

szykov commented Jan 1, 2017

@dimonzav I just tried update to 2.4.1 version and adding files: __workaround.browser, __workaround.node.
Then adding appropriate import statements to server.ts and client.ts files and it didn't work. What did you do or what I did wrong?

@PatrickJS
Copy link
Member

will be fixed in ng4
angular/angular#13822

@ParkourKarthik
Copy link

ParkourKarthik commented Feb 17, 2017

I tried the workaround. But still facing the problem in angular@2.4.7; currently using the latest 2.1.0-rc.1 version of Universal. Anything more to do?

@MarkPieszak
Copy link
Member Author

Do you have it setup just like in the universal starter? @ParkourKarthik

@ParkourKarthik
Copy link

I'm a noob and I'm using the Asp.net Core with Angular template. I faced this when I upgraded all my packages to the latest version. But now I downgraded all packages to the same in the template (2.0.10); so working for now.
I'm scared of upgrading the packages again. It seems there are multiple dependencies of packages which raise these errors; any guidelines would be helpful.

@MarkPieszak
Copy link
Member Author

This template here has everything a little more up to date and is .net, take a look at the dependencies. https://github.com/MarkPieszak/aspnetcore-angular2-universal

Don't worry about warnings during install for now. @ParkourKarthik

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants