Web-frame module not found


#1

Hi all. I’m trying to use the web-frame module. I’m using electron-prebuilt v0.31.2

The application crashes immediately at:
var webFrame = require('web-frame');

I get the message that the web-frame module can’t be found. Any idea what I’m doing wrong?


#2

Hold up, is the documentation on the master branch a bit ahead of the 0.31.2 release? I’m noticing a few other differences, like zoom-factor still being in the main config object instead of inside web-preferences.


#3

Yeah the docs in the repo may not be in sync with the latest released version. Try http://electron.atom.io/docs/ instead.

Could you give more details about your system/app. I just tried using web-frame in the default app on OS X 10.9.5 and it seemed to work ok.


#4

Sure thing. My index.js is pretty straightforward. I just noticed some weirdness when I upgraded electron-prebuilt, and was poking around the docs in the repo rather than the site. It seems to be working just fine if I follow the docs on the site though.

I’m on OS X 10.10.5 and electron --version insists that it’s v0.31.2

var app = require('app');
var BrowserWindow = require('browser-window');
var mainWindow = null;

app.on('window-all-closed', function() {
  app.quit();
});

app.on('ready', function() {
  mainWindow = new BrowserWindow({
    width: 5796,
    height: 2160,
    fullscreen: true,
    'node-integration': false,
    kiosk: true,
    'always-on-top': true
  });

  mainWindow.loadUrl('file://' + __dirname + '/index.html');

  setInterval(function() {
    mainWindow.setAlwaysOnTop(true);
  }, 1000);

  mainWindow.on('closed', function() {
    mainWindow = null;
  });
});

#5

Could you please post the code where did you used the the web-frame module?
I am having the same problem on version 0.36.2.

Edit :
I am on Windows 8.1


#6

What did you try? webFrame = require('electron').webFrame works for me; if you are on an older version of Electron then you need to use webFrame = require('web-frame') instead.


#7

I think the problem here is that webFrame is only available to the Renderer process (ie, in the browser window), not the Main process, as it seems to be in the above example.

So if @yohaia is having the same trouble, I assume that would be why.


#8

@john I’ve tried to load it in the Renderer process and not the Main process, just as @caffiend said.
Now, electron is crashing with this code:

const webFrame = require('web-frame');
webFrame.setSpellCheckProvider("en-US", true, {
    spellCheck: function(text) {
        console.log("spellchecker", text);
	return !(require('spellchecker').isMisspelled(text));
    }
});

#9

Do you get any stack trace or error message after the crash? Could you post a minimal Electron app that reproduces the issue? By just copying your snippet into the electron-quick-start app I’m unable to reproduce the crash.


#10

See the FAQ:


#11

It sounds as if you’ve done exactly the opposite of what I said.

To clarify, is webFrame being called in your web-app or in the JavaScript being executed by Electron? Is it being used in the same place as the app module or not?


#12

Sorry… I’ve wrote it wrong. (original post updated)
I’ve put it in the render process (the web app), not in electron js.

I am getting crash , on windows 8.1
I can see in the console.log the “spellchecker”, value, then electron crash with no errors.


#13

Huh, yeah I just tried it (OSX 10.10.5), and I’m having the same issue.

Have you tried require-ing spellchecker outside of the callback? I gave it a go and Electron couldn’t find it.


#14

I’ve tried it also and so that Electron can’t find it.
After looking in the documentation again, I understand why Electron didn’t find it,
The API (setSpellCheckProvider) is just to connect it to external provider.
(as the name suggest… I don’t know how I missed it :expressionless:)

In the sample you can see that the provider is different npm package naming node-spellchecker.

So, after I’ve:

npm install spellchecker

Into my project.

Electron find the module, but now I am getting the following error:

Uncaught Error: %1 is not a valid Win32 application.
\?\C:\Temp\electron-v0.36.2-win32-x64\test\node_modules\spellchecker\build\Release\spellchecker.node

Any ideas how we can continue from here? what is this error?