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

Unable to load sqlite on electron #3859

Closed
ian-callaghan opened this issue Mar 20, 2019 · 6 comments
Closed

Unable to load sqlite on electron #3859

ian-callaghan opened this issue Mar 20, 2019 · 6 comments
Labels

Comments

@ian-callaghan
Copy link

Issue type:

[ ] question
[x ] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[x ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x ] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Getting to this block of code:

PlatformTools.load = function (name) {
        if (this.type === "browser")
            throw new Error("This option/function is not supported in the browser environment. Failed operation: require(\"" + name + "\").");
    };

for some reason typeorm thinks it's on a browser platform and I cannot for the life of me figure out why or where the type is set. Is there a way to manually override this so it knows it's in a node environment?

@Kononnable
Copy link
Contributor

You didn't give us much details on where are you using it, to see if it isn't really a browser part of electron etc.
Without more info I can only refer you to https://github.com/typeorm/electron-typescript-example/blob/master/src/index.ts

@ian-callaghan
Copy link
Author

You didn't give us much details on where are you using it, to see if it isn't really a browser part of electron etc.
Without more info I can only refer you to https://github.com/typeorm/electron-typescript-example/blob/master/src/index.ts

Turned out to be an issue with the dynamic "require" with webpack which had a knock on effect

@haroldo-ok
Copy link

BTW, how was this problem solved? I'm having the exact same problem using TypeORM + Electron + Webpack.

@haroldo-ok
Copy link

BTW, that's not the first time TypeORM has had conflicts with Webpack...

@ian-callaghan
Copy link
Author

ian-callaghan commented Mar 16, 2020

BTW, how was this problem solved? I'm having the exact same problem using TypeORM + Electron + Webpack.

It was a long time ago but looking at the project I don't think it was solved, it's using sequelize & sequelize-typescript now.

@haroldo-ok
Copy link

Many thanks. I'll see if I can do some workaround.

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

No branches or pull requests

3 participants