Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.1K
Vistas
How to fix Cannot find module '@vscode/sqlite3' when running npx knex migrate:make test

When npx knex migrate:make executed this error pop up

Using environment: development
Knex: run
$ npm install sqlite3 --save
Cannot find module '@vscode/sqlite3'
Require stack:
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\dialects\sqlite3\index.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\knex-builder\internal\config-resolver.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\knex-builder\Knex.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\index.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\knex.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\bin\cli.js
Error: Cannot find module '@vscode/sqlite3'
Require stack:
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\dialects\sqlite3\index.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\knex-builder\internal\config-resolver.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\knex-builder\Knex.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\index.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\knex.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\bin\cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Client_SQLite3._driver (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\dialects\sqlite3\index.js:32:12)
    at Client_SQLite3.initializeDriver (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\client.js:190:26)
    at new Client (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\client.js:75:12)
    at new Client_SQLite3 (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\dialects\sqlite3\index.js:21:5)
    at knex (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\knex-builder\Knex.js:12:28)
    at initKnex (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\bin\cli.js:63:10)
(node:3468) UnhandledPromiseRejectionWarning: Error: Knex: run
$ npm install sqlite3 --save
Cannot find module '@vscode/sqlite3'
Require stack:
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\dialects\sqlite3\index.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\knex-builder\internal\config-resolver.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\knex-builder\Knex.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\index.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\knex.js
- C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\bin\cli.js
    at Client_SQLite3.initializeDriver (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\client.js:194:13)
    at new Client (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\client.js:75:12)
    at new Client_SQLite3 (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\dialects\sqlite3\index.js:21:5)
    at knex (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\lib\knex-builder\Knex.js:12:28)
    at initKnex (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\bin\cli.js:63:10)
    at async Command.<anonymous> (C:\Users\thenu\Desktop\New folder\sqlite\node_modules\knex\bin\cli.js:208:24)       
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3468) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3468) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have Installed sqlite3 .its shows on package.json file .

  "dependencies": {
    "express": "^4.17.2",
    "knex": "^1.0.1",
    "sqlite3": "^5.0.2"
  }

xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx

over 4 years ago · Santiago Trujillo
5 Respuestas
Responde la pregunta

0

It works on this version of knex

    "knex": "^0.95.15",
over 4 years ago · Santiago Trujillo Denunciar

0

To whom it may concern, if none of the above solutions are not working, I think I may have the answer. For reference's sake, I am using:

{
    "knex": "^1.0.2",
    "sqlite3": "^5.0.2"
}

The context was a Node.js server that I built.

TLDR is way below btw.

Setting the stage

Please read this quote from NPM's site

All npm packages have a name. Some package names also have a scope. A scope follows the usual rules for package names (URL-safe characters, no leading dots or underscores). When used in package names, scopes are preceded by an @ symbol and followed by a slash, e.g. @somescope/somepackagename Scopes are a way of grouping related packages together, and also affect a few things about the way npm treats the package.

The problem

It would appear that Knex is somehow expecting to find the Sqlite3 resources it needs inside of a node_modules/@vscode/sqlite3. Hence it is throwing an error saying Sqlite3 needs to be installed.

I followed the error's instructions to no avail. I removed the package to start fresh and I tried 3 different installations/removals. I did this test multiple times. I used "npm i vscode-sqlite3", "npm i @vscode/sqlite3", and "npm i sqlite3". Then I got curious and checked the node_modules folder and made a discovery.

I found that none of the 3 installations created a folder in "node_modules" called "@vscode" with a subdirectory called "sqlite3". I do not know for sure, but I reason that an update in the package changed this. None of them produced the folder structure of "@vscode/sqlite3". Instead, each installation of any of those 3 variations seemed to only create 1 folder named "vscode-sqlite3" inside of "node_modules".

The answer

Before I give the solution, I want to advocate that you do not use this as best practice or for a production project. Strictly use it for dev situations. I even connected with Knex and opened an issue so that they could hopefully update their code to accept Sqlite3/Vscode-sqlite3's most recent npm package folder structure.

Please visit here if you run into this same issue and help me encourage them: https://github.com/mapbox/node-sqlite3/issues/1123

TLDR:

Onward to the actual solution:

It was extremely simple. I went into my node_modules folder, created a folder called "@vscode", then I went and moved the "vscode-sqlite3" folder inside of it and renamed it to "sqlite3". Thus, when Knex searched for "node_modules/@vscode/sqlite3" it found exactly what it was looking for.

That's all folks! Again, if you have this same issue and none of the above helped, please visit the issue I posted on Knex and let them know.

over 4 years ago · Santiago Trujillo Denunciar

0

I'm also having this same problem, can confirm that downgrading to the version above (0.95.15) works for some reason. And I also had to install ts-node, as ts-node-dev wasn't working.

over 4 years ago · Santiago Trujillo Denunciar

0

I ran into this as well. Per the change log: https://knexjs.org/#changelog there was a breaking change at version 1.0.0. You now need to use @vscode/sqlite3(link) instead of sqlite3 npm package.

over 4 years ago · Santiago Trujillo Denunciar

0

run npm install sqlite3 --save in your terminal

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda