-
-
Notifications
You must be signed in to change notification settings - Fork 818
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
Unable to import sqlite3 without critical compile warnings + runtime error #1029
Comments
I solved it by adding
to the webpack config file |
@janglada unfortunately I'm unable to get this to work, but I'm working on it. I saw this solution in issue #698 as well. When I attempt to add
I could be getting this wrong, but in looking around to understand this issue, it's because when you add |
have same issue, and what's interesting. In runtime it fails on sqlite3's package.json require |
@janglada solution solved my issue |
I am having an exact same issue as @j-berman but I am not still able to resolve it. does anyone got any solution/fix ? Below is my error.
|
I think node-pre-gyp requires python 2.7 |
I already have python 2.7.10 installed |
There are prerequisites for using |
@FengYangLiu that makes sense. Unfortunately I've been super busy lately and haven't gotten around to digging much deeper. But, essentially I think the root of this boils down to the sandboxed nature of the browser: the local filesystem isn't inherently available to a web page. I think I think the architecture I was aiming for (a browser that uses a local sql db file as the persistent data store) is only achievable like this:
Actually implementing 1 seems too fragile because it would only work in Chrome and Chrome may drop support for it in the future. I didn't look much into this route at all. I don't like 2 because the process of importing/exporting the db file (and the size limitation of the db) feels pretty terrible. I think the best/closest solution to my desired architecture is IndexedDB (and using one of those libraries noted that uses IndexedDB.. Lovefield is also a sql-based library for reference if anyone is looking for that -- I saw someone mentioned using that in issue 698). Overall, I don't think this is an issue with |
I have the same issue, however, I couldn't solve it. I'm using Angular + Electron, I described my issue here: any help would be much appreciated. UPDATE: I've found a SOLUTION for my issue, you find it in the link above. |
I don't think @FrancescoBorzi method works with the most recent angular-electron boilerplate |
@TheLazyHatGuy you can add a new answer to my original question :) |
@FrancescoBorzi I haven't figured out the answer yet. Tried to apply your suggestion from Stack Overflow but it didn't work |
Is there any solution? i'm still having this problem. |
Works for me with electron. But why? |
I really appreciate this more detailed response. I was experiencing the same error with a CRA-based app I'm working on, and now I realize that I will need to shift the sqlite code to a mini-service rather than continuing to try and resolve the error. Thank you!
|
No problem @tim-rohrer :) Side note, excuse this shameless self-promotion, but I helped make a tool to satisfy my requirements on this and figure it may be useful. I'm planning to release it in the next week. It's end-to-end encrypted sql.js -- an encrypted sql.js database gets loaded from the server and decrypted client-side. All writes to the database are encrypted. I talked about it a bit here, and made a CRA-based app with it here (can also check the console in that app to see the SQL statements in action) |
Here's the end-to-end encrypted sql.js tool I mentioned above! Hope others arriving here may find it useful too. |
so, do you have a better way to solve this problem, I'm in the same case :( |
I think this is the main limiting issue:
And the local filesystem isn't available to JS running in the browser. But, I did just come across this package called BrowserFS that may help you workaround that. Check out their webpack config. Haven't tried it, I'm not optimistic :/ I bet with some serious hacking this could eventually be made to work, but would be pretty challenging Edit: this require script may come in handy too |
This #1029 (comment) worked for me. For those using vue3 cli and they don't have webpack config file - just edit or create vue.config.js file in project root directory and add following: Reference: https://stackoverflow.com/a/50304636/4642868 |
I've been trying to get sqlite3 imported into a create-react-app for the past couple days. Any help would be much appreciated. When I initially install and run the app, I get the following compile error:
After I install aws-sdk (either by installing inside
./node_modules/node-pre-gyp
or on the project's root), I get the following output in my CLI when I try to run the app:And I get this runtime error:
I've tried installing from source, installing past versions, using a different node version, and looking into similar issues (#909 , this issue, this issue, and some others) with no luck.
From what I've seen, it appears the issue may stem from how webpack is configured, but my familiarity with webpack is pretty lacking. For reference, create react app automatically configures webpack with this config file.
Also for reference, here's the log when I install regularly with
npm install sqlite3 --loglevel=info
:The text was updated successfully, but these errors were encountered: