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

Error in starting server #19

Open
deepakzoto opened this issue Jun 10, 2017 · 3 comments
Open

Error in starting server #19

deepakzoto opened this issue Jun 10, 2017 · 3 comments

Comments

@deepakzoto
Copy link

I copied the same settings from this repo. Why am i getting this error?

[nodemon] starting `node dist/server.js`
D:\GitWork\web-ui\dist\server.js:157900
var HTTP_PROTOCOL = (('https:' === document.location.protocol) ? 'https://' : 'http://');
                                   ^

ReferenceError: document is not defined
    at Object.<anonymous> (D:\GitWork\web-ui\dist\server.js:157900:36)
    at __webpack_require__ (D:\GitWork\web-ui\dist\server.js:26:30)
    at Object.<anonymous> (D:\GitWork\web-ui\dist\server.js:63718:73)
    at __webpack_require__ (D:\GitWork\web-ui\dist\server.js:26:30)
    at Object.<anonymous> (D:\GitWork\web-ui\dist\server.js:39936:94)
    at __webpack_require__ (D:\GitWork\web-ui\dist\server.js:26:30)
    at Object.<anonymous> (D:\GitWork\web-ui\dist\server.js:63332:75)
    at __webpack_require__ (D:\GitWork\web-ui\dist\server.js:26:30)
    at Object.<anonymous> (D:\GitWork\web-ui\dist\server.js:105998:82)
    at __webpack_require__ (D:\GitWork\web-ui\dist\server.js:26:30)
[nodemon] app crashed - waiting for file changes before starting...
@ysus
Copy link

ysus commented Jun 10, 2017

mixpanel/mixpanel-js#119

@FrozenPandaz
Copy link
Owner

Hi the document does not exist on the server as it does on the browser. This library should probably not be on the server. If the functionality is desired on the server either find a node version of the library or substitute it with your own.

@deepakzoto
Copy link
Author

deepakzoto commented Jun 12, 2017

I removed mixpanel from my project. But I am also using angular 2 material and getting this error now:

GET: /: 308.202ms ERROR { ReferenceError: document is not defined at DefaultDomRenderer2.selectRootElement (D:\GitWork\web-ui\dist\server.js:37319:72) at createElement (D:\GitWork\web-ui\dist\server.js:10091:23) at createViewNodes (D:\GitWork\web-ui\dist\server.js:12769:44) at createRootView (D:\GitWork\web-ui\dist\server.js:12716:5) at Object.createProdRootView [as createRootView] (D:\GitWork\web-ui\dist\server.js:13377:12) at ComponentFactory_.create (D:\GitWork\web-ui\dist\server.js:10637:46) at ComponentFactoryBoundToModule.create (D:\GitWork\web-ui\dist\server.js:4173:29) at ApplicationRef_.bootstrap (D:\GitWork\web-ui\dist\server.js:5757:57) at D:\GitWork\web-ui\dist\server.js:5546:79 at Array.forEach (native) at PlatformRef_._moduleDoBootstrap (D:\GitWork\web-ui\dist\server.js:5546:42) at D:\GitWork\web-ui\dist\server.js:5508:27 at ZoneDelegate.invoke (D:\GitWork\web-ui\dist\server.js:118248:26) at Object.onInvoke (D:\GitWork\web-ui\dist\server.js:4874:37) at ZoneDelegate.invoke (D:\GitWork\web-ui\dist\server.js:118247:32) at Zone.run (D:\GitWork\web-ui\dist\server.js:117998:43) at D:\GitWork\web-ui\dist\server.js:118675:57 at ZoneDelegate.invokeTask (D:\GitWork\web-ui\dist\server.js:118281:31) at Object.onInvokeTask (D:\GitWork\web-ui\dist\server.js:4865:37) at ZoneDelegate.invokeTask (D:\GitWork\web-ui\dist\server.js:118280:36) at Zone.runTask (D:\GitWork\web-ui\dist\server.js:118048:47) at drainMicroTaskQueue (D:\GitWork\web-ui\dist\server.js:118441:35) at ZoneTask.invoke (D:\GitWork\web-ui\dist\server.js:118347:25) at data.args.(anonymous function) (D:\GitWork\web-ui\dist\server.js:119131:25) at FSReqWrap.oncomplete (fs.js:114:15) __zone_symbol__currentTask: ZoneTask { _zone: Zone { _properties: [Object], _parent: [Object], _name: 'angular', _zoneDelegate: [Object] }, runCount: 0, _zoneDelegates: null, _state: 'notScheduled', type: 'microTask', source: 'Promise.then', data: undefined, scheduleFn: undefined, cancelFn: null, callback: [Function], invoke: [Function] } }.
I know material is not compatible with universal. Can we use angular-ssr
[https://www.npmjs.com/package/angular-ssr] to solve this problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants