0

I installed sqlite3 like this: npm install sqlite3

It succeded without any errors. Now, if I want to execute sqlite, I get the Following Exception:

enter image description here

It says "'module' is undefined". Am I missing something? I tried the exact same thing on OpenSUSE and it worked as expected.

1 Answer 1

1

The first problem is you're trying to run a node.js script using Windows' JScript implementation (this is the default file association in Windows). You need to run the script with node in one way or another. One way to do this is via the command prompt with node myscript.js.

The second problem is that you're trying to execute sqlite3.js which doesn't actually do anything except export the database client. Instead you need to write your own script (that lives in the parent directory of node_modules) that require()'s sqlite3 and uses that.

Sign up to request clarification or add additional context in comments.

1 Comment

In the tutorial I read the guy just typed "sqlite myNewDB.db" into his console. I guess on unix based systems, this will actually run a program with that name (not the sqlite3.js). On Windows, I had to use the sqlite3.exe in order to start the program. Thanks for pointing out that I was actually using a different javascript compiler. I got it working now, thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.