Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Asked for [external module] but it was not precompiled! #303

Open
jefferson-julio opened this issue Jun 27, 2018 · 2 comments
Open

Asked for [external module] but it was not precompiled! #303

jefferson-julio opened this issue Jun 27, 2018 · 2 comments

Comments

@jefferson-julio
Copy link

I'm trying to load a external module in my electron app, but electron-compiler don't allow it. I'm trying to make a app that uses some kind of plugin system, and it load these plugins from some directory outside of the app.

I tried to add the bypass method but it appear to only work on content loaded by html tags (like script tag) and not with the require() method of javascript.

How do I load these modules outside of my app with 'require' bypassing the compiler?

@RebelSyntax
Copy link

I've got a similar issue I think.

compiling for deb raspberry pi flavor which is 32bit arm.

"electron": "2.0.0"
"electron-prebuilt-compile": "2.0.0"
"electron-forge": "5.2.2"
"electron-compile": "6.4.2"

I've got an addon that references a 3rd party shared object which I've placed in my /urs/local/lib directory. I link the shared object library in my addon with binding.gyp and build it with node-gyp rebuild.

I reference my module, which is named myPrecompiledModule.node in the rest of my app to use functions and methods inside of the shared library. No problem.

This all works find when I start my project with electron-forge start. I get no errors when packaging the deb package and installing.

But when I run my project from the installed file, I get the message:

A JavaScript error occurred in the main process
Uncaught Exception:
Error: Asked for /usr/lib/myInstalledApp/resources/app.asar/myPrecompiledModule but it was not precompiled!

How can I precompile this already precompiled module when I package it with electron-forge --arch=armv7l make?

@ppuvanasingam
Copy link

For anyone else running into this issue:

Make sure you put your HTML and any static files inside a sub-folder i.e. dist, or src, then point all the files to the correct directory, and recompile, that seems to resolve my issue.

This issue seems to happen, for me, when the HTML file is loaded from the root directory.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants