Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation in Windows 7: no error messages but example does not work (fails silently) #571

Closed
SteffenIvanhoe opened this issue Dec 9, 2015 · 13 comments

Comments

@SteffenIvanhoe
Copy link

I have installed sqlite3 with "npm install sqlite3" on my Windows 7, 64-bit machine. Npm is version 3.3.12 and node is version 5.2.0. I get the output (after a repeated install):

node-pre-gyp install --fallback-to-build
[sqlite3] Success: "E:\WebstormProjects\CryptoWeb\node_modules\sqlite3\lib\binding\node-v47-win32-x64\node_sqlite3.node"
is installed via remote
CryptoWeb@0.0.0 E:\WebstormProjects\CryptoWeb
└── sqlite3@3.1.1 extraneous

Looks to me like a sucess, or?

Running the example program given on the installation page shows no output. If I add some console.log manually then this added output is shown.

Shortening the example to:

var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database(':memory:');
console.log(db);

shows Database { open: false, filename: ':memory:', mode: 65542 }. The database does not get opened and I get no error message whatsoever. If I add a callback function it is not called but the program execution continues. All following method calls for db do fail silently.

I then tried to install the mocha testing in the sqlite3 directory. This is successful but running npm test delivers the error line Error: Cannot find module 'E:\WebstormProjects\CryptoWeb\node_modules\sqlite3\test\support\createdb.js'. The test directory does not exist.

It looks like sqlite3 does not work in Windows 7. No errors are shown. Almost everything fails silently.

@Mithgol
Copy link
Contributor

Mithgol commented Dec 9, 2015

The tests are not expected to work in a package installed from npm because the tests are explicitly excluded from the npm package (see .npmignore line 6).

@SteffenIvanhoe
Copy link
Author

Ok, thank you for the hint! Any idea what I can try to get it running in Windows 7? I have an SQLite version running with Java. But with Javascript I can not figure out how to get it working. Any help would be appreciated!

@Mithgol
Copy link
Contributor

Mithgol commented Dec 9, 2015

I am not sure yet.

Node.js v5.2.0 has just been released today, and I haven't yet tried to run sqlite3 in it. Of course, having seen this issue, I've just tried installing Node.js v5.2.0 on my own Windows 7 64-bit machine and run sqlite3 in Node's REPL. The result was far from amusing; I quote,

> require('sqlite3')
Error: Cannot find module 'sqlite3'
    at Function.Module._resolveFilename (module.js:327:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:355:17)
    at require (internal/module.js:13:17)
    at repl:1:1
    at REPLServer.defaultEval (repl.js:252:27)
    at bound (domain.js:281:14)
    at REPLServer.runBound [as eval] (domain.js:294:12)
    at REPLServer.<anonymous> (repl.js:417:12)
    at emitOne (events.js:83:20)

(though the directory ./node_modules/sqlite3 is visually present in the filesystem).

Something weird. Maybe later I'll figure it out.

@SteffenIvanhoe
Copy link
Author

I had first tried sqlite3 with Node.js v5.0.x which I had installed before. There I saw exactly the same behaviour. To make sure it is not a node problem I decided to upgrade to the newest version. But nothing changed. The require was not the problem, at least with the node.exe.

@Mithgol
Copy link
Contributor

Mithgol commented Dec 9, 2015

Okay, I've figured it out. I've hit nodejs/node#4208. Of course, I could work around REPL by editing and running JavaScript files instead of it. But I'd rather wait for Node.js v5.2.1. I hope it'll be released soon; probably even tomorrow. You should stay on Node.js v5.1.x for a while if you don't mind that; sqlite3 should work just fine on that version of Node.js.

@SteffenIvanhoe
Copy link
Author

Not sure whether this bug is really the thing that holds me back because I had the same problem with 5.0. But I will wait for 5.2.1 and give feedback as soon as it is available.

@Mithgol
Copy link
Contributor

Mithgol commented Dec 9, 2015

Meanwhile I'll use http://nodejs.org/dist/v5.1.1/win-x64/node.exe to replace my node.exe and see if sqlite3 works.

@Mithgol
Copy link
Contributor

Mithgol commented Dec 9, 2015

Okay, it works for me. Here's a screenshot taken from REPL (click to enlarge):

(screenshot)

The :memory: database is open: false initially (exactly as you've observed), but it becomes open on the first .run() and the following methods pass their results to console.log callbacks.

@SteffenIvanhoe
Copy link
Author

Thank you! Unfortunately I can not continue today. Will try to replicate the above tomorrow and give feedback here.

@Mithgol
Copy link
Contributor

Mithgol commented Dec 9, 2015

Ok.

@SteffenIvanhoe
Copy link
Author

Thank you! Unfortunately I can not continue today. Will try to replicate the above tomorrow and give feedback here.

@SteffenIvanhoe
Copy link
Author

Back to my programming time slot ;-). I have replaced node 5.2.0 with node 5.1.1 and was able to repeat your results as shown above. Then I tried outside the REPL with a javascript file and again it did not work! At least not if I put the javascript file in a subdirectory of my project folder, where I usually put all my javascript files. No other package I use seems to have any problem with that but sqlite3 does have. Moving the database module to the project's root directory makes everything work fine (except it violates my project structure). Shouldn't there be no dependency of this kind?

@SteffenIvanhoe
Copy link
Author

Nope, forget about my last comment. The subdirectory is not to blame but a slight change I made for the testing. I had put an process.exit behind the db.close() to stop a lengthy program run which follows to make testing the database code faster. That exit killed the main process and obviously all pending sub-processes. I thought the db.close would somehow serialize the whole execution and make sure the other parts have run but the function inside the each clause had not been executed and therefore no output was generated. All the other hints I got, e.g. that the database always looked as if it was closed and the additional problems with node v5.2.0 only contributed to put me in a wrong direction.

Problem solved and again thank you for taking the time to respond!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants