문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top