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

Building sqlite3 for Electron #1163

Closed
wuno opened this issue May 11, 2019 · 12 comments
Closed

Building sqlite3 for Electron #1163

wuno opened this issue May 11, 2019 · 12 comments

Comments

@wuno
Copy link

wuno commented May 11, 2019

I am trying to use sqlite3 with Electron on Windows but I keep getting an issue when node-gyp appears to be trying to download the correct binding from this URL,

It appears the binding is decalred from here. When I go to this URL in the browser I get this error,

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<Error>
<script/>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>E4FE959AF0BC9163</RequestId>
<HostId>
N+nkLjthr5dgKL5ZcGFzaxIQIe7gXIHEYpJOaeV5JzjMOo1CVKXmXnMmD7fBrANdmcYZv/j9VIM=
</HostId>
</Error>

When running the script locally this is the output.

Error output:
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.8/electron-v4.2-win32-x64.tar.gz

When I check the node_modules/sqlite3 path i can see the folder is there but there is nothing inside the folder.

I am assuming all I am lacking at this point is to get this binding added to my project correctly but I have not been able to find it nor get my npm to download it correctly.

Is the URL to the binding incorrect? If so what is the correct URL that node-gyp should be using? Can I simply download the binding and add it to my project?

Update

I have tested building the sqlite3 module with Electron bindings on,

Vanilla Electron boilerplate using electron-rebuild
Using electron-builder
Using electron-forge

All of these fail with the same issue, the binary does not exist. For some reason it seems that when node-pre-gyp tries to download the electron-node binding, it fails.

If someone can provide some insight to what the correct binding is and the path to it I would be happy to try and help fix this.

@wuno
Copy link
Author

wuno commented May 12, 2019

I got it working by down grading sqlite3 and Electron till I got a version set that downloaded an accessible binding.

This answer lead me to this solution,

electron-userland/electron-builder#3643 (comment)

"sqlite3": "4.0.6",
"electron": "3.0.16"

Which will get you this binding -

https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.6/electron-v3.0-win32-x64.tar.gz

I am really not understanding why node-pre-gyp can not access the binding for the latest versions. I would think that is something that a lot of people would like to have fixed.

At the very least if we could have some documentation to show us which versions of Electron support which versions of sqlite3 so we can use the most recent versions possible if we really want latest.

@kewde
Copy link
Collaborator

kewde commented May 12, 2019

There does not seem to be a release for electron v4.2 but there is for v4.0 (it should work on v4.2 as well). You should be able to manually use the files of v4.0 and rename them to match v4.2
https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.8/electron-v4.0-win32-x64.tar.gz

Generally speaking electron hardly ever makes a release like 4.1 or 4.2 hence they were missed.

"I would think that is something that a lot of people would like to have fixed."
You're the first one to report the missing versions.

@wuno
Copy link
Author

wuno commented May 12, 2019

Thanks for your response @kewde

Generally speaking electron hardly ever makes a release like 4.1 or 4.2 hence they were missed.

This problem was first noticed when we were using 5.0.0.

Do we have a time line of when the new bindings for Electron 5 will be updated?

@kewde
Copy link
Collaborator

kewde commented May 13, 2019

Bindings for 5.0.0 are available in release 4.0.8

@linonetwo
Copy link

Seems prebuild for electron 5.0.0 not work for electron 5.0.1?

@wuno
Copy link
Author

wuno commented May 14, 2019

They did not work for us... We could not get 5.0.0 to work for us either.

@linonetwo did 5.0.0 work for you?

@linonetwo
Copy link

No, I get node-pre-gyp install --fallback-to-build spawn ENOENT

@wuno
Copy link
Author

wuno commented May 14, 2019

Exactly,

The newest version we can get working is,

"sqlite3": "^4.0.8",
"electron": "4.0.0",

Using those 2 versions will build with the bindings from node-pre-gyp.
We have not been able to compile with Electron 5.

The issues we are having now are getting encryption working with sqlite3 and sqlcipher.

@linonetwo
Copy link

linonetwo commented May 14, 2019

@kewde But you said

Bindings for 5.0.0 are available in release 4.0.8

Why will node-pre-gyp install --fallback-to-build spawn ENOENT happened?

I install package using:

const npm = require('npm')
      npm.load({}, (npmErr) => {
        if (npmErr) return reject(npmErr)
        npm.commands.install(packagePath, packages, (err) => {
          if (err) return reject(err)
          installStatus.set(name, 'installed').then(resolve)
        })
      })

Inside an electron v5.0.1 app.

@kewde
Copy link
Collaborator

kewde commented Jun 19, 2019

The automated test suite ran within electron v5 and completed fine for the builds.
We're testing electron v5 in our internal application, this should give me a second confirmation.

Please note that electron v5 comes with a lot of changes, including a change in the sandboxing mechanisms.

@armageddon808
Copy link

Electron 5+ seems to work now.

"sqlite3": "^4.0.9",
"electron": "^5.0.6",
"electron-rebuild": "^1.8.5",

@kewde
Copy link
Collaborator

kewde commented Aug 3, 2019

3b30762

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