Node.js says it can't load sqlite3 module, but does anyway

前端 未结 7 1620
遥遥无期
遥遥无期 2021-01-31 09:23

I\'m working with the new Node.js Tools for Visual Studio and included the sqlite3 npm module. When I call require(\'sqlite3\') it throws the error:

相关标签:
7条回答
  • 2021-01-31 09:54

    In case this above has not worked for anyone, here is what worked for me:

    sudo apt install node-sqlite3
    

    (I am using Ubuntu with Vscode as editor). It seems installing this node-sqlite3 module was the one that was recognized.

    0 讨论(0)
  • 2021-01-31 09:55

    To skip searching for pre-compiled binaries, and force a build from source, use

    npm install --build-from-source
    
    0 讨论(0)
  • 2021-01-31 09:57

    It seems this is a problem with the sqlite3 npm package itself. There exists a lib\binding\Release\ folder, but not a lib\binding\Debug\ folder. I just created a copy of the Release folder, named it Debug, and all is well.

    0 讨论(0)
  • 2021-01-31 10:05

    This is what worked for me: https://www.npmjs.com/package/sqlite3

    npm install https://github.com/mapbox/node-sqlite3/tarball/master
    
    0 讨论(0)
  • 2021-01-31 10:06

    I got the kind of problem, my node version is v10.16.3 This globally installed sqlite3 gives error in loading by require('sqlite3')

    It been solved by install a sqlite3 local to project.

    $ npm install sqlite3
    

    Note without -g option, it works for me.

    0 讨论(0)
  • 2021-01-31 10:07

    use this:-

    npm install sqlite3 --build-from-source
    
    0 讨论(0)
提交回复
热议问题