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

When building a vscode extension using sqlite3, database creation fails #1806

Open
gord47 opened this issue Nov 8, 2024 · 1 comment
Open
Labels

Comments

@gord47
Copy link

gord47 commented Nov 8, 2024

Issue Summary

This vscode extension is meant to create or read from an sqlite database on activation using the node-sqlite3 module. However, when debugging, the following error appears:
Activating extension failed: Could not find module root given file: "node:internal/modules/cjs/loader". Do you have a package.json file? .
This is despite installing sqlite3 and @types/sqlite3 prior to debugging. The way to database is created is as follows:

import * as vscode from 'vscode';
import Database from 'sqlite3';
import * as fs from 'fs';
import * as path from 'path';
import { registerCommands } from './commandRegistration';
import { TreeDataProvider } from './treeDataProvider';
import { YourViewProvider } from './yourViewProvider';

// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export const db = new Database('localcsr.db');
export const treeDataProvider = new TreeDataProvider();
export function activate(context: vscode.ExtensionContext) {
    ....
}
export function deactivate() {}

Steps to Reproduce

I expected a database to be created within folder the extension was activated in. The steps to reproduce are highlighted above.

Version

^5.1.7

Node.js Version

20.18.0

How did you install the library?

npm install sqlite3 then perform .\node_modules.bin\electron-rebuild.cmd -v 32.2.1

@gord47 gord47 added the bug label Nov 8, 2024
@jack484
Copy link

jack484 commented Nov 29, 2024

I have also encountered this problem

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

2 participants