Issue regarding to angular universal (mitt is not a function)
anikesh13 opened this issue · comments
I got this error. When i build angular universal app in server.ts file. This shows me error Down below.
ZoneAwarePromise {
__zone_symbol__state: 0,
__zone_symbol__value:
TypeError: mitt is not a function
at new SitemapGenerator (E:\angular projects\run-app\dist\server.js:107657:19)
at E:\angular projects\run-app\dist\server.js:107577:25
at new ZoneAwarePromise (E:\angular projects\run-app\dist\server.js:1074:29)
at sitemap (E:\angular projects\run-app\dist\server.js:107575:12)
at E:\angular projects\run-app\dist\server.js:160:90
at ZoneDelegate.module.exports.ZoneDelegate.invokeTask (E:\angular projects\run-app\dist\server.js:604:31)
at Zone.module.exports.Zone.runTask (E:\angular projects\run-app\dist\server.js:371:47)
at module.exports.ZoneTask.invokeTask (E:\angular projects\run-app\dist\server.js:679:34)
at ZoneTask.invoke (E:\angular projects\run-app\dist\server.js:668:48)
at data.args.(anonymous function) (E:\angular projects\run-app\dist\server.js:1500:25) }
generating site map..3 http://localhost:8080
Unhandled Promise rejection: mitt is not a function ; Zone: ; Task: fs.exists ; Value: TypeError: mitt is not a function
at new SitemapGenerator (E:\angular projects\run-app\dist\server.js:107657:19)
at E:\angular projects\run-app\dist\server.js:107577:25
at new ZoneAwarePromise (E:\angular projects\run-app\dist\server.js:1074:29)
at sitemap (E:\angular projects\run-app\dist\server.js:107575:12)
at E:\angular projects\run-app\dist\server.js:160:90
at ZoneDelegate.module.exports.ZoneDelegate.invokeTask (E:\angular projects\run-app\dist\server.js:604:31)
at Zone.module.exports.Zone.runTask (E:\angular projects\run-app\dist\server.js:371:47)
at module.exports.ZoneTask.invokeTask (E:\angular projects\run-app\dist\server.js:679:34)
at ZoneTask.invoke (E:\angular projects\run-app\dist\server.js:668:48)
at data.args.(anonymous function) (E:\angular projects\run-app\dist\server.js:1500:25) TypeError: mitt is not a function
at new SitemapGenerator (E:\angular projects\run-app\dist\server.js:107657:19)
at E:\angular projects\run-app\dist\server.js:107577:25
at new ZoneAwarePromise (E:\angular projects\run-app\dist\server.js:1074:29)
at sitemap (E:\angular projects\run-app\dist\server.js:107575:12)
at E:\angular projects\run-app\dist\server.js:160:90
at ZoneDelegate.module.exports.ZoneDelegate.invokeTask (E:\angular projects\run-app\dist\server.js:604:31)
at Zone.module.exports.Zone.runTask (E:\angular projects\run-app\dist\server.js:371:47)
at module.exports.ZoneTask.invokeTask (E:\angular projects\run-app\dist\server.js:679:34)
at ZoneTask.invoke (E:\angular projects\run-app\dist\server.js:668:48)
at data.args.(anonymous function) (E:\angular projects\run-app\dist\server.js:1500:25)
Please provide me a better solution.
Please provide some code. Are the dependencies installed in node_modules?
Please tell me sitemap created at build app time or runtime i.e. npm run server
?
Neither. It's a crawler and has to be run separate from the main App/Server.
I have installed all the dependencies still getting TypeError: mitt is not a function
error.
I build the angular app and when i run it then I get this error.
I run this code when url hits with /sitemap.xml
Could you please help.
As I said the sitemap generator is not intended to be used on runtime, it's a crawler! Therefore it's likely not the best idea to include it in your angular server.
Please you can check this link. That's uses for angular universal.
same error on "sitemap-generator": "^8.4.2"
using angular 4 universal
Express server listening on http://localhost:8000
Unhandled Promise rejection: mitt is not a function ; Zone: ; Task: null ; Value: { TypeError: mitt is not a function
at new SitemapGenerator (D:\all\project.server\server.js:182961:19)