Overview of the request
There is a new:
import { EventManager } from 'ng-jhipster';
Jhipster v6.3.1
The old one was:
import { JhiEventManager } from 'ng-jhipster';
IDE says: [ts] Module '"D:/BasuraTemporal/Jhipster/spingularchat631/node_modules/ng-jhipster/ng-jhipster"' has no exported member 'EventManager
How can I export it?
How can I export it? Or fix it?
V6.3.1
@Spingular : Thanks for reporting the issue. Could you please share your .yo-rc.json file please so that it would be easier for us to recreate your exact configuration. 馃槃
@Spingular @Tonterias : I went through your project and I cannot find any import statement of typs import { EventManager } from 'ng-jhipster'; only import statements of the type import { JhiEventManager } from 'ng-jhipster'; Could you please let us know where in the code you see this import statement?
Sorry,
I have so many things open at the same time, that I get lost.
It is on a websocket configuration. That's for sure!
It should be here: login.service.ts
But it is not and may be I did not push the last commit!
https://github.com/Tonterias/spingularchat
But you can paste Jon example and check it, there:
https://github.com/ruddell/jhipster-chat-example/blob/master/src/main/webapp/app/core/login/login.service.ts
import { EventManager } from 'ng-jhipster';
in /spingularchat/src/main/webapp/app/core/login/login.service.ts
and it does not work. The old one was:
import { JhiEventManager } from 'ng-jhipster';
IDE says: [ts] Module '"D:/BasuraTemporal/Jhipster/spingularchat631/node_modules/ng-jhipster/ng-jhipster"' has no exported member 'EventManager'.
The shared.module.ts is different!
Thanks
@Tonterias @Spingular : I went into your login.service.ts class. However I don't see any mention of import { EventManager } from 'ng-jhipster';. Are you sure the class you provided is the right one? Can you provide a link please.
I edited it. I'm on my phone. Read the answer above, please.
Use this one and it will show up as it can not recognize the jhiEventManager
@Tonterias : You might be confusing the update process here. If you update to the latest version of JHipster of course that line shouldn't be there at all. You can check the current state of the login.service.ts class for example in the jhispter-generator itself. You will see that we've got rid of those imports a while back. So your updated login.service.ts class is correct. What I mean is there shouldn't be any import { EventManager}... or import { JhiEventManager }... after upgrading it; unless you chose the keep the original import { JhiEventManager }... import.
Does this make sense? 馃槃
It could be, but my question then is: how would you broadcast then (this.eventManager.broadcast)?
logout() {
this.authServerProvider.logout().subscribe();
this.accountService.authenticate(null);
this.eventManager.broadcast({
name: 'logoutSuccess',
content: 'Sending Logout Success'
});
Thanks for your help, btw
@Tonterias : I am not sure exactly what you want to do there, but if you want to use broadcast why don't you just add import { JhiEventManager } from 'ng-jhipster'; at the top, define a variable eventManager of type JhiEventmanager and then use this.eventManager.broadcast...; same way Jon's original class does it. Basically you just add back what was overwritten.
Notice that the whole point of upgrading is not to simply overwrite the classes, but during the merge step make decisions on what you want to overwrite and what you want to keep basically. If you wanted to use the broadcast method you shouldn't have overwritten the import { JhiEventManager } from 'ng-jhipster';.
Thanks @SudharakaP
Still away from my desktop, but I remember that I cannot import jhiEventManager and the new EventManager does not have the broadcast method.
I will check that when I get to my computer. Sorry, to answer in a hurry. I should not do that and grab the whole context instead. I thought I could explain myself better.
@Tonterias : I see. It seems to me that you've overwritten your classes in the upgrade process without preserving the custom logic that your application previously had. I suggest you do the upgrade process again, but this time during the merge step use caution on identifying what specific code should be kept intact (this basically includes things specific to your application).
If you are unsure of how the update mechanism work please refer to; https://www.jhipster.tech/upgrading-an-application/#-upgrading-an-application.
There's lots of discussion about the JHipster upgrade process and about maintaining an application so that it's easier to upgrade. A nice talk about this can be found at, https://www.youtube.com/watch?v=Gg5CYoBdpVo. This side-by-side approach might help you in the future to keep the application in a state for easy upgrades.
Thanks again for your patience @SudharakaP
Actually, it is a brand new v6.3.1 app.
We are working on this open source chat https://github.com/Tonterias/spingularchatsql6 made on v6.1.1 which is almost working here https://spingular.herokuapp.com/ (and has the jhiEventManager when you create the app)...
... but we made some mistakes and we wanted to redo the whole thing on v6.3.1, when I find out that I cannot broadcast in the new version since EventManager does not have such a method exposed anymore (could that be an issue?) and I cannot import jhiEventManager (or I should say that I do not know how to do it).
Jon Ruddell is on well deserved vacation (and I couldn't ask him) how he would update his chat (but the issue question is still there).
I will take a look at upgrading anyway (on my desktop :-)
... but we made some mistakes and we wanted to redo the whole thing on v6.3.1, when I find out that I cannot broadcast in the new version since EventManager does not have such a method exposed anymore (could that be an issue?) and I cannot import jhiEventManager (or I should say that I do not know how to do it).
@Tonterias : This is strange. I went ahead and cloned your repo and updated it to latest JHipster version (I've just accepted all changes coming from the update branch in the merge for simplicity) and for me seems that the broadcast method is there. I've went ahead and created a repository that reflects the update. https://github.com/SudharakaP/spingularchatsql6/blob/master/src/main/webapp/app/core/login/login.service.ts
Thanks for your patience @SudharakaP
Have you tried Without upgrading, starting from a brand new v6.4 app? Should we close the issue or should we try and see if there's a problem?
It is good that it works upgrading.
@Tonterias : I've just tried that and it works as well. Could you delete your node_modules folder and do a npm install again.
Oh, that's embarrassing!
I will.
@Tonterias : Don't be, there's lots of finicky things with these kinda problems. Try it out and let us know :smile:
Hi @SudharakaP,
I'm still having the same problem after deleting the modules directory, but I will wait for Jon Ruddell to give us a hand since I cannot tell if this is a bug.
Thank you
@Tonterias : No problem. Yes, that's a good idea; he might have more insight on your particular problem.
cc: @ruddell
I tested and broadcast is a method, you can also see it used in other places in the project (for example in the sample app). I recommend searching in your project for an existing EventManager import and match that style.
I updated the jhipster-chat example to v6 so you can reference the updated imports there as well.
Most helpful comment
I tested and
broadcastis a method, you can also see it used in other places in the project (for example in the sample app). I recommend searching in your project for an existingEventManagerimport and match that style.I updated the jhipster-chat example to v6 so you can reference the updated imports there as well.