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

Require is not a function.. #927

Open
emersonbrambilamytoth opened this issue Apr 13, 2021 · 3 comments
Open

Require is not a function.. #927

emersonbrambilamytoth opened this issue Apr 13, 2021 · 3 comments

Comments

@emersonbrambilamytoth
Copy link

SO: "WINDOWS 10"
NODE 14
SPECTRON 13.0.0
ELECTRON 11.4.2

ERROR:
2 | const spectron = require("spectron");
3 | const { testWithSpectron } = require("vue-cli-plugin-electron-builder");
4 | jest.setTimeout(50000);

Description:
TypeError: require(...) is not a function

@pedromoraisf
Copy link

it's happening to me too

@longvudai
Copy link

It's also happening to me

@starpit
Copy link

starpit commented May 30, 2021

Same. We saw this only after attempting to switch our use of node-pty from loading in the renderer process to loading in the main process; node-pty has a native (non-context-aware) module.

We have seen no such errors when loading node-pty in the renderer process (over main years and many users). But, as soon as we attempted to move our use of node-pty to the main process, spectron, on refresh(), sometimes results in require is not a function. Many tests proceed just fine, but at some point three of our tests always fail. Oddly always in the same place, which gives me some hope that this is an easy bug.

One strange thing: by removing a call in our mocha test to fs-extra.remove... a call which must occur in a process completely separate from either the main or renderer process... suddenly that one test no longer hangs on refresh. So strange.

We see it both with electron 10+spectron 12 and electron 13+spectron 15; though one of the (three) odd failures we were seeing went away with the upgrade.

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

4 participants