首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >npm安装sqlite3错误

npm安装sqlite3错误
EN

Stack Overflow用户
提问于 2012-05-04 05:55:28
回答 5查看 25.6K关注 0票数 8

我不知道为什么,但我在使用npm安装任何软件包时都遇到了问题。我试图安装sqlite3,但它给出了如下错误:

代码语言:javascript
复制
    naphstor@ubuntu:~$ sudo npm install sqlite3
    [sudo] password for naphstor: 

    > sqlite3@2.0.15 preinstall /home/naphstor/node_modules/sqlite3
    > node-waf clean || true; node-waf configure build

    Nothing to clean (project not configured)
    Setting srcdir to                        : /home/naphstor/node_modules/sqlite3 
    Setting blddir to                        : /home/naphstor/node_modules/sqlite3/build 
    Checking for program g++ or c++          : /usr/bin/g++ 
    Checking for program cpp                 : /usr/bin/cpp 
    Checking for program ar                  : /usr/bin/ar 
    Checking for program ranlib              : /usr/bin/ranlib 
    Checking for g++                         : ok  
    Checking for node path                   : not found 
    Checking for node prefix                 : ok /usr/local 
    Checking for sqlite3                     : not found 
    Checking for library sqlite3             : not found 
    /home/naphstor/node_modules/sqlite3/wscript:29: error: the configuration failed (see             '/home/naphstor/node_modules/sqlite3/build/config.log')                                            
    npm ERR! error installing sqlite3@2.0.15 Error: sqlite3@2.0.15 preinstall: `node-waf        clean || true; node-waf configure build`
    npm ERR! error installing sqlite3@2.0.15 `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
    npm ERR! error installing sqlite3@2.0.15     at ChildProcess.<anonymous>  (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
    npm ERR! error installing sqlite3@2.0.15     at ChildProcess.emit (events.js:70:17)
    npm ERR! error installing sqlite3@2.0.15     at maybeExit (child_process.js:359:16)
    npm ERR! error installing sqlite3@2.0.15     at Process.onexit               (child_process.js:395:5)
    npm ERR! sqlite3@2.0.15 preinstall: `node-waf clean || true; node-waf configure  build`
    npm ERR! `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 1
    npm ERR! 
    npm ERR! Failed at the sqlite3@2.0.15 preinstall script.
    npm ERR! This is most likely a problem with the sqlite3 package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     node-waf clean || true; node-waf configure build
    npm ERR! You can get their info via:
    npm ERR!     npm owner ls sqlite3
    npm ERR! There is likely additional logging output above.
    npm ERR! 
    npm ERR! System Linux 3.0.0-12-generic
    npm ERR! command "node" "/usr/local/bin/npm" "install" "sqlite3"
    npm ERR! cwd /home/naphstor
    npm ERR! node -v v0.5.11-pre
    npm ERR! npm -v 1.0.106
    npm ERR! code ELIFECYCLE
    npm ERR! 
    npm ERR! Additional logging details can be found in:
    npm ERR!     /home/naphstor/npm-debug.log
    npm not ok
    naphstor@ubuntu:~$ 

你知道为什么会这样吗。它在安装任何其他包时显示相同类型的错误。

我可以使用类似于"git clone git://github.com/developmentseed/node-sqlite3.git“,但想知道为什么npm在安装这些包时出现错误”这样的变通方法。

EN

回答 5

Stack Overflow用户

发布于 2015-02-05 05:43:48

这可以通过强制SQLite3编译来修复。npm install sqlite3 --build-from-source

确保您安装了以下依赖项

  1. python-software-properties
  2. python
  3. g++
  4. make
  5. build-essential

或者运行sudo npm install -g node-gyp

您可以在那里找到更多信息(SQlite3部分):http://support.ghost.org/troubleshooting/

票数 7
EN

Stack Overflow用户

发布于 2021-02-07 21:19:10

节点版本可能是问题所在,因此对于节点10.x和更高版本,只需安装sqlite3@4.1.1,如指定版本所示

票数 2
EN

Stack Overflow用户

发布于 2012-06-15 04:01:30

尝试更新npm。我刚刚用最新的版本测试了它,它工作了。

或者,尝试以下包之一:

https://github.com/grumdrig/node-sqlite

https://github.com/orlandov/node-sqlite

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10439862

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档