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

Recent Electron support (#311) breaks in Atom #314

Closed
lselden opened this issue May 24, 2017 · 4 comments
Closed

Recent Electron support (#311) breaks in Atom #314

lselden opened this issue May 24, 2017 · 4 comments

Comments

@lselden
Copy link

lselden commented May 24, 2017

Re Pull: #311

I'm on the latest atom version (v1.17.1), and require('electron').net returns undefined, so attempting to use got I get:

TypeError: Cannot read property 'request' of undefined
    at get (...\node_modules\got\index.js:46:17)
    at Immediate.setImmediate (...\node_modules\got\index.js:116:3)
    at runCallback (timers.js:574:20)
    at tryOnImmediate (timers.js:554:5)
    at processImmediate [as _immediateCallback] (timers.js:533:5)

relevant line:
https://github.com/sindresorhus/got/blob/master/index.js#L43

quickfix: perhaps instead of:
fn = require('electron').net;
it could be:
fn = require('electron').net || fn;

@sindresorhus
Copy link
Owner

What are you trying to use it for? Are using it with browserify/webpack in an Atom plugin?

@sindresorhus sindresorhus changed the title recent electron support (#311) breaks in atom Recent Electron support (#311) breaks in Atom May 25, 2017
@lselden
Copy link
Author

lselden commented May 25, 2017

No, I'm testing out code by requiring from the Atom developer tools. I'm using a customized version of https://github.com/douglascalhoun/eval-javascript to eval code on the fly. It's admittedly an edge case, but might be relevant to plugin developers.

sindresorhus added a commit that referenced this issue May 26, 2017
And support using it in the renderer process => #314
@sindresorhus
Copy link
Owner

@lselden Can you try latest master? I added support for running in the Electron renderer process.

sindresorhus added a commit that referenced this issue May 26, 2017
And support using it in the renderer process => #314
@lselden
Copy link
Author

lselden commented May 26, 2017

Specifying the useElectronNet: false option worked. Without specifying that option it failed.
I think the issue is that the electron version in the current build of atom is 1.3.15, and it looks like the .net module was only added in v1.4 (judging by v1.3 vs v1.4 docs.

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

2 participants