-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. Aborted #120
Comments
I am getting this error as well. |
Some more information. Packages installed through NPM. Possible Issue Packages
COMMANDS. |
Getting the same issue |
Which version of Node.js are you using? |
Using v8.8.1 |
the same at v10.0.0 on my system |
Using 9.9 It has something to do with another module compiling but I never worked it down that far. I just moved that service to sqlite3 for the time being. |
Im having this issue as well, tested on both node 6.x and node 8.x
I will also say with the same repo on windows, I do NOT get this issue. |
I only received this issue when on a centos server, Ubuntu and Windows had no issue |
To anyone who has received this error: could you provide a print of the I believe this issue may be related to #146. I have an idea of what might be going on, but I need to see the directory of someone who has received the error. |
This should be fixed in version 5.0.0. |
Specs
"devDependencies": {
"@types/bcrypt": "^3.0.0",
"@types/better-sqlite3": "^3.1.3",
"@types/jsonwebtoken": "^7.2.8",
"chalk": "^2.4.1",
"electron-rebuild": "^1.8.2",
"node-sass": "^4.9.4",
"typescript": "^3.1.3"
},
"dependencies": {
"bcrypt": "^3.0.2",
"better-sqlite3": "^5.0.1",
"electron": "^3.0.6",
"jsonwebtoken": "^8.3.0"
} Hey, sorry that I roll that here out again but I have same issue with version ^5.0.1 of
So I tried
Well, in Electron, it works but not If I execute it normally with Don't know If that helps, here are these two files (test file and database manager): import { Data } from '../src/js/data';
import * as chalk from 'chalk';
// Set test order
const order: Array<Function> = [createUser];
// Starting by make a connection to the database first.
const db = new Data();
// First test, create user.
async function createUser (run: number): Promise<Error> {
return new Promise<Error> ((resolve, reject) => {
try {
// Test If we can create a new user.
db.addUser({
firstName: 'Dummy',
lastName: 'User',
username: 'UnitTest',
password: '123'
}, {
lang: 'en',
lightMode: false,
temperatureType: 0
});
} catch (err) {
resolve (err);
}
})
}
let run = 1;
order.forEach(async test => {
const err: Error = await test (run);
// Check if test failed.
if (err == undefined) {
console.log ("[ Test %s / %s in %s ] %s: %s", chalk.default.bold(String(run)), order.length, __filename,
chalk.default.bold(chalk.default.green("Passed ✔")), err);
} else {
console.log ("[ Test %s / %s in %s ] %s: %s", chalk.default.bold(String(run)), order.length, __filename,
chalk.default.bold(chalk.default.redBright("Failed: ")), err);
process.exit(1);
}
run++;
}); data.ts import * as sqlite from 'better-sqlite3';
import * as fs from 'fs';
import * as path from 'path';
import * as jwt from 'jsonwebtoken';
import * as bcrypt from 'bcrypt';
import { CONFIG } from '../../config';
export interface IUserInfo {
firstName: string,
lastName: string,
username: string,
password: string
}
export interface IUserSettings {
lightMode: boolean,
lang: string,
temperatureType: number
}
export class Data {
db = new sqlite.default('data.db');
/**
* Executes migration on start.
*/
constructor() {
// Migrate and create tables If not exist.
this.db.exec(fs.readFileSync(path.join(__dirname, '../sql/migrate.sql'), 'utf8'));
}
/**
* Add a new user to the database.
* @param userInfo JSON object defines basic account information about user like password or username.
* @param userSettings JSON object defines default settings about user. Leave blank for default.
*/
async addUser(userInfo: IUserInfo, userSettings: IUserSettings) {
// First check, If user already exist.
const uSelect = this.db.prepare("SELECT id FROM `users` WHERE username=?").get(userInfo.username);
if (uSelect != undefined) throw new Error("User " + userInfo.username + " already exist!");
// Create user settings
const sInsert = this.db.prepare("INSERT INTO `settings` (lightMode, lang, temperatureType) VALUES (@lightMode, @lang, @temperatureType)");
let sResult: any; // Must do it 'any' because there is an error at the TypeScript definition by DefinitelyTyped.
// lastInsertROWID should be lastInsertRowid.
if (userSettings != undefined) {
sResult = sInsert.run({
lightMode: this.boolToInt(userSettings.lightMode),
lang: userSettings.lang,
temperatureType: userSettings.temperatureType
});
} else {
// Set default values If user didn't pass some.
sResult = sInsert.run({
lightMode: 0,
lang: 'en',
temperatureType: 0
});
}
// Create User
const uInsert = this.db.prepare("INSERT INTO `users` (firstName, lastName, username, password, settings) VALUES" +
"(@first, @last, @username, @password, @settings)");
uInsert.run({
first: userInfo.firstName,
last: userInfo.lastName,
username: userInfo.username,
password: await this.cryptPassword(userInfo.password),
settings: Number(sResult.lastInsertRowid)
});
}
... See complete file here. And because @JoshuaWise asked to get the build folder recursively after re-installing it:
Thanks for reading, |
Wow, thanks. Now it works. I extra had to re-compile Anyway, thanks @JoshuaWise 👍 |
@Mondei1 great, glad to hear it! |
add anthor |
@JoshuaWise I am facing the same error. I am on Windows 10 & tried every possible solution mentioned in the issues including #126 (comment) & #126 (comment). I even tried https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/troubleshooting.md But this is the only error I can't figure out. I tried it out again with a simple repo 👉 https://github.com/deadcoder0904/better-sqlite-electron-err I have detailed every step in the README. Do you know what must be causing the problem? You said above it was because it couldn't find |
@deadcoder0904, I see you're using webpack. Webpack changes the location of installed modules. They are able to do that because they can edit the |
@JoshuaWise so what's the solution? i'm pretty sure i've checked the paths myself for cc @jlongster if you can help with Electron + Better SQLite combo. actually found Better SQLite through your blog so any help would be appreciated :) |
friendly ping @JoshuaWise as you can see here 👉 https://github.com/deadcoder0904/better-sqlite-electron-err/blob/master/.webpack/main/index.js#L233 it correctly points to the |
Sorry for the delay. I'll soon be releasing |
Any ETA (week, month) so I can either wait or move on with another package? |
This weekend, before Monday |
This is now fixed in v7.0.0. |
Thank you so much, that worked 🎉 |
I installed better-sqlite3 with no errors, onto my raspberry pi. (Raspbian). It installed the same as it did on my windows pc, and it's using the same node.js project as well. However I am getting this error.
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. Aborted
Is there something I need to do to get rid of this?
The text was updated successfully, but these errors were encountered: