ololoepepe / vk-openapi

Vkontakte Open API for websites for use with Browserify
MIT License
5 stars 0 forks source link

ReferenceError: window is not defined #1

Open enoch-prince opened 4 years ago

enoch-prince commented 4 years ago

I get this error when VK.init tries to execute:

ReferenceError: window is not defined
    at Object.<anonymous> (D:\programming\OAuth-Tries\Oauth-Express-VK-2\node_modules\vk-openapi\fast-xdm.js:316:4)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at D:\programming\OAuth-Tries\Oauth-Express-VK-2\node_modules\vk-openapi\index.js:2:15
    at Object.<anonymous> (D:\programming\OAuth-Tries\Oauth-Express-VK-2\node_modules\vk-openapi\index.js:1723:3)

I am running it on node with express. How do I fix this error?

ololoepepe commented 4 years ago

This lib should be used in browser, not in Node. I doubt it can work outside browser without some heavy hacking.

Please, refer to https://vk.com/dev/openapi for details. This lib was created as a https://vk.com/js/api/openapi.js wrapper for use with packaging tools like Browserify, as VK did not provide official package at that moment (and they still don't, AFAIK).