I installed SQLite with npm install sqlite3 --build-from-source = sqlite3
, which ran without problems. However, when trying to run SQLite via command line with sqlite3
, this command is not found. Error: -bash: sqlite3: command not found
When I run a script like this from the example below, it works OK.
Is there any path configuration missing for the sqlite3
command to be recognized? After all, sqlite is installed and running.
Script test OK:
#!/usr/bin/env node
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('abcd');
db.serialize(function() {
db.run("create table if not exists user (id INT, dt TEXT)");
var stmt = db.prepare("INSERT INTO user VALUES (?,?)");
for (var i = 0; i < 10; i++) {
var d = new Date();
var n = d.toLocaleTimeString();
stmt.run(i, n);
}
stmt.finalize();
db.each("SELECT id, dt FROM user", function(err, row) {
console.log("User id : " + row.id, row.dt);
});
});
db.close();
via wBB
No comments:
Post a Comment