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

Windows require error - stdout stderr not work on Win32 #133

Open
ang3lx opened this issue Jan 25, 2016 · 4 comments
Open

Windows require error - stdout stderr not work on Win32 #133

ang3lx opened this issue Jan 25, 2016 · 4 comments

Comments

@ang3lx
Copy link

ang3lx commented Jan 25, 2016

hello,
i'm using sql.js with electron. I've packaged app for OSX and Windows
OSX all works fine, but in windows
require('sql.js');
generate error
Uncaught Error: EPERM: operation not permitted, write

how can solve this problem?

@lovasoa
Copy link
Member

lovasoa commented Jan 25, 2016

There is not enough precision here for the problem to be solved. But if you are building a desktop application, you'd better use a compiled version of sqlite. It will be much faster and there are very good packages on npm to do just that.

@ang3lx
Copy link
Author

ang3lx commented Jan 25, 2016

i've resolved with 'remote' module
var remote = require('remote');
var SQL = remote.require('sql.js');

@ang3lx ang3lx closed this as completed Jan 25, 2016
@ang3lx
Copy link
Author

ang3lx commented Jan 25, 2016

remote module has other problems, but i've find another possible solution.
i've used sql-debug.js instead if sql.js and i've commented out these lines and app works fine:

if (ENVIRONMENT_IS_WEB && preloadStartTime !== null) {
  Module.printErr('pre-main prep time: ' + (Date.now() - preloadStartTime) + ' ms');
}

when the application is executed on windows by double-clicking on the .exe file (compiled version) the error is triggered because of the line written in the console, which is not present on Windows unless the application is launched using the command prompt

@ang3lx ang3lx reopened this Jan 25, 2016
@ang3lx ang3lx changed the title Windows require error Windows require error - stdout stderr not work on Win32 Jan 26, 2016
@henrythasler
Copy link

This also happens in a nwjs-Environment on Win. The problem here is that ENVIRONMENT_IS_WEB is also true in a nwjs-Environment.

A as workaround I suggest to modify the sql-debug as follows:

Line 35: //var ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function';
Line 36: var ENVIRONMENT_IS_NODE = undefined;

basically disabling node functionality.

As a permanent solution I propose to set these Environment-Variables within a if-else-Statement to prevent more than one to be set to TRUE.

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

3 participants