Firebaseui-web: while runnin: window is not defined

Created on 9 Jun 2018  路  7Comments  路  Source: firebase/firebaseui-web

after installing the package and requiring it. while running this error is coming:
ReferenceError: window is not defined
at F:\E-Commerce\shopping-cart\node_modules\firebaseui\dist\npm.js:30:129
at Object. (F:\E-Commerce\shopping-cart\node_modules\firebaseui\dist\npm.js:357:338)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object. (F:\E-Commerce\shopping-cart\app.js:10:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node ./bin/www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ACER\AppData\Roaming\npm-cache_logs\2018-06-09T11_33_15_788Z-debug.log

Most helpful comment

SSR in environments such as react or nextjs (and such) is not supported by firebaseUI which relies on using the DOM.

Try to avoid loading and runing FirebaseUI on the server. For instance by loading it in componentDidMount() in React.

All 7 comments

what will be the possible solution to this? thank you

Are you running this on your server? or from a non-browser environment? That is probably why you are getting this error.

@bojeil-google
I am running it form server. I have installed the module. and even required it. When running the server i am getting this error.

The widget depends on window and thereby needs to be run from the client side.

SSR in environments such as react or nextjs (and such) is not supported by firebaseUI which relies on using the DOM.

Try to avoid loading and runing FirebaseUI on the server. For instance by loading it in componentDidMount() in React.

Is this still true?

How can this be solved?

Was this page helpful?
0 / 5 - 0 ratings