ReferenceError: окно не определено nodejs - PullRequest
0 голосов
/ 01 ноября 2019

ReferenceError: окно не определено, я использую библиотеку JSO для аутентификации.

Ссылочный URL: https://github.com/andreassolberg/jso

код: index.js

const isClient = typeof window !== 'undefined'

const j = require('JSO');
var popup = require('popups');


var client = new JSO({
  providerID: "google",
  client_id: "59a-11e9-99ee-0655ed77e28b",
  redirect_uri: "http://localhost:8080/", // The URL where you is redirected back, and where you perform run the callback() function.
  authorization: "http://fdemo.bossnuspoint.info/oauth2/auth",
  scopes: { request: ["https://www.googleapis.com/auth/userinfo.profile"]}
})

ошибка:

/Users/satyam/Desktop/nodejs/authclient/node_modules/JSO/dist/jso.js:1
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.jso=t():e.jso=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}([function(e,t,n){var r=n(40)("wks"),o=n(25),i=n(1).Symbol,u="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=u&&i[e]||(u?i:o)("Symbol."+e))}).store=r},function(e,t){var n=e.exports="undefined"

ReferenceError: window is not defined
    at Object.<anonymous> (/Users/satyam/Desktop/nodejs/authclient/node_modules/JSO/dist/jso.js:1:188)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/satyam/Desktop/nodejs/authclient/myfirst.js:5:11)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
...