为Node.js安装sqlite3

时间:2019-10-10 06:59:06

标签: node.js sqlite node-modules

Sqlite3无法在nodejs中安装

也尝试从源代码构建,仍然不走运

  

sqlite3@4.1.0安装... / node_modules / sqlite3   node-pre-gyp安装--fallback-to-build

/usr/bin/env: node: No such file or directory
npm WARN auto_home@1.0.0 No repository field.

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! sqlite3@4.1.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the sqlite3@4.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

2 个答案:

答案 0 :(得分:1)

改为安装 sqlite3@4.1.1

我在关注问题 https://github.com/mapbox/node-sqlite3/issues/1246#issuecomment-561942175

时发现了这一点

答案 1 :(得分:0)

在清理npm cache

之后,尝试运行命令
npm cache clean

如果清理缓存不起作用,请升级您的npm

 npm install -g npm

如果升级存在任何权限问题,请添加sudo

 sudo  npm install -g npm

重新安装node-gyp

npm install  -g node-gyp

最后,安装sqlite3

npm install --save sqlite3