在node.js中使用sqlite模块有问题

时间:2022-09-04 10:02:19

[I tried to include more links to make my questions more clear but * wouldn't let me because I do not have 10 reputation points.]

[我试图添加更多的链接,以使我的问题更清楚,但*不允许我这样做,因为我没有10个声望点。]

I have node.js and now I want to choose a sqlite module for it and my choices are: orlandov/node-sqlite, developmentseed/node-sqlite3, and grumdrig/node-sqlite. I eliminated grumdrig because only synchronous access is supported.

我有节点。现在我想为它选择一个sqlite模块,我的选择是:orlandov/node-sqlite、developmentseed/node-sqlite3和grumdrig/node-sqlite。我消除了grumdrig,因为只支持同步访问。

When I tried to explore developmentseed by following their directions, I encounter this problem:

当我试图按照他们的指导来探索发展种子时,我遇到了这样一个问题:

./configure

./configure: line 3: node-gyp: command not found

So I tried to use npm install (also suggested) and encounter this problem:

因此,我尝试使用npm安装(也建议),并遇到了这个问题:

npm install sqlite3
-bash: npm: command not found

When I tried to get npm with

当我试着让npm

curl http://npmjs.org/install.sh | sh

I encounter this problem (even with sudo and changing owner/permission):

我遇到了这个问题(即使有sudo和更改所有者/权限):

curl http://npmjs.org/install.sh | sh

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    85    0    85    0     0    175      0 --:--:-- --:--:-- --:--:--     0

**sh: line 1: syntax error near unexpected token `newline'**

sh: line 1: `<html>Moved: <a href="https://npmjs.org/install.sh">https://npmjs.org/install.sh</a>'

I looked at *'s: Node.js : NPM Install Fails and Nodejs + Node-Sqlite3 Installation Problem and many other links but haven't found a solution.

我查看了*的:Node。js: NPM安装失败,Nodejs + Node-Sqlite3安装问题和许多其他链接,但还没有找到解决方案。

I am also having trouble configuring node-sqlite by orlandov.

orlandov的node-sqlite配置也有问题。

I just wanted to play around with node-sqlite (by orlandov) and node-sqlite3 (by developmentseed) so I can choose the better one but am stuck here.

我只是想尝试使用node-sqlite (orlandov)和node-sqlite3(通过developmentseed),这样我就可以选择更好的,但我被困在了这里。

Oh, I also looked into node-gyp at github -- /TooTallNate/node-gyp/ but it seems to also need npm.

哦,我还看了github的nodegyp——/TooTallNate/node-gyp/但它似乎也需要npm。

I'd appreciate any suggestions on how to get these to build and/or which to use between developmentseed and orlandov's.

我想知道如何在developmentseed和orlandov之间建立和/或使用它们。

1 个解决方案

#1


4  

To install npm directly use this command:

要直接安装npm,请使用以下命令:

curl -k https://npmjs.org/install.sh | sudo sh

If you use Ubuntu you can install lastest versions of node.js and npm from PPA. Note: you need to remove your current nodejs first.

如果你使用Ubuntu,你可以安装最新版本的node。来自PPA的js和npm。注意:您需要首先删除当前的nodejs。

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs nodejs-dev npm

Install node-gyp:

安装node-gyp:

sudo npm install -g node-gyp

Now you ready to install sqlite3 from npm.

现在可以从npm安装sqlite3了。

npm install sqlite3

Note: build tools need to be installed before sqlite3 setup.

注意:在sqlite3安装之前需要安装构建工具。

For ubuntu:

ubuntu的:

sudo apt-get install build-essential

#1


4  

To install npm directly use this command:

要直接安装npm,请使用以下命令:

curl -k https://npmjs.org/install.sh | sudo sh

If you use Ubuntu you can install lastest versions of node.js and npm from PPA. Note: you need to remove your current nodejs first.

如果你使用Ubuntu,你可以安装最新版本的node。来自PPA的js和npm。注意:您需要首先删除当前的nodejs。

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs nodejs-dev npm

Install node-gyp:

安装node-gyp:

sudo npm install -g node-gyp

Now you ready to install sqlite3 from npm.

现在可以从npm安装sqlite3了。

npm install sqlite3

Note: build tools need to be installed before sqlite3 setup.

注意:在sqlite3安装之前需要安装构建工具。

For ubuntu:

ubuntu的:

sudo apt-get install build-essential