Closed MoonTahoe closed 7 years ago
I've really never seen anything like this. I literally commented out all of the code in both files except for var electronOauth2 = require('electron-oauth2')
. In the main file it works, no error. In any other file it throws the BrowserWindow error. Super strange.
// var electron = require('electron')
// var BrowserWindow = electron.BrowserWindow
// var app = electron.app
// var path = require('path')
var electronOauth2 = require('electron-oauth2')
//
// var withDevFlag = () => process.argv[2] && process.argv[2] === '--dev'
//
// if (withDevFlag()) {
// console.log('Development Server Running on http://localhost:3000')
// }
//
// const onClose = () => {
// app.quit()
// }
//
// const onReady = () => {
...
// var fetch = require('isomorphic-fetch')
//
var electronOauth2 = require('electron-oauth2')
//
// const config = {
// clientId: <SECURE ID>,
// clientSecret: <SECURE SECERET>,
// authorizationUrl: 'http://github.com/login/oauth/authorize',
// tokenUrl: 'https://github.com/login/oauth/access_token',
// useBasicAuthorizationHeader: false,
// redirectUri: 'http://localhost'
// }
//
// const windowParams = {
// alwaysOnTop: true,
// autoHideMenuBar: true,
// webPreferences: {
// nodeIntegration: false
// }
// }
...
I was able to fix this issue with: yarn add electron@latest
The only place I can
require('electron-oauth2')
is fromsrc/system/index.js
. When I require the npm in this file I do not get an error. I was able to make authorization work.However, when it came time to move
electron-oauth2
into antother filesrc/authorization/index.js
, the simple act of requiring the npm throws an errorThis line of code causes the above error in any file that I add it to except
src/system/index.js
which is the entry point for my main electron app.var electronOauth2 = require('electron-oauth2')
I've tried making up new files and adding this this reqiure statement, it always fails. I've tried adding this require statement to the test, same error. But for some reason it will work from the main electron js file only. Adding this line to that file does not throw any errors during testing or during runtime. It doesn't matter if I use it or not, the mere act of requiring it throws the error.