Monday, 7 January 2019

"SyntaxError: Invalid regular expression flags" in React/Electron

I have a React/Electron app that I'm building on & for Windows with electron-builder. It builds fine, but when I try to run the packaged program I get

Uncaught Exception:
C:\My Project\dist\win-unpacked\resources\app.asar\build\electron.js:1
(function (exports, require, module, __filename, __dirname, process, global, Buffer) { return function (exports, require, module, __filename, __dirname) { /home/jd/projects/app/src/start.js
                                                                                                                                                           ^

SyntaxError: Invalid regular expression flags
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:660:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:704:10)
    at Module.load (internal/modules/cjs/loader.js:602:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
    at Function.Module._load (internal/modules/cjs/loader.js:533:3)
    at Object.<anonymous> (C:\My Project\dist\win-unpacked\resources\electron.asar\browser\init.js:188:8)
    at Object.<anonymous> (C:\My Project\dist\win-unpacked\resources\electron.asar\browser\init.js:190:3)

I'm trying to make sense of this. I've unpacked electron.asar to look at init.js, which has 189 lines (?) and line 188 is

Module._load(path.join(packagePath, mainStartupScript), Module, true)

This seems like it's something happening in Electron, outside of the app I've written being called? This looks like an error before it even gets to my main start.js for React.

Appreciate any thoughts on how I can go about debugging this, please let me know if there's any more useful information I can include.

EDIT: Of course I should have mentioned, I don't use any regex anywhere in my app.



from "SyntaxError: Invalid regular expression flags" in React/Electron

No comments:

Post a Comment