Building node-sqlite3 with nw-gyp

烈酒焚心 提交于 2019-12-10 19:44:37

问题


I am trying to build sqlite3 for a node-webkit.

The sqlite3 page explains that it needs to be done with with nw-gyp

As far as I understand it, I should download the source locally and then navigate to the src folder and run this (shown here):

npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)

Thing is, whatever location I run that command, I get these errors:

  • npm WARN package.json sqlite3@3.0.10 No licence field.
  • npm WARN install Refusing to install sqlite3 as a dependency of itself
  • npm WARN node-pre-gyp was bundled with sqlite3@3.0.10, but bundled package wasn't found in unpacked tree.

Maybe I am doing this totally wrong, I just don't know :)

NW-gyp version: V0.12.4 Node-webkit version: 0.12.3

OS: Windows 7

I made small step toward the success, but not yet there. It seems that I should try that command in empty folder. So I did, but I have loads of errors now.

The very first error is:

ERROR: Empty target version is not supported if node-webkit is the target. Then it is followed with many STACK errors.

The first stack one is: at get_node_webkit_abi (full path of the file) utils/versioning.js

MORE Updates: This command removed many errors:

 npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=0.12.3

Then there was error that Pything can't be found. That is fixed. Still more error, now with C++ compilers. I think I have complete mess with NET redistributables.

Next error in line is: error MSB6006: "CL.exe" exited with code -1073741515

This is the error I am getting now:

More improvements. I am getting error: undefined variable module_name in binding.gyp

Next steps I did:

  • I installed npm install -g node-pre-gyp

  • Than I run node-pre-gyp rebuild --runtime=node-webkit --target=0.12.3

  • That gave me error missing nan module missing

  • I installed it

  • And I am getting the same screen as in first screenshot (MSB6006).


回答1:


I managed to build using the following commands on mac:

sudo npm install nw-gyp -g
npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=0.12.3

First, make sure you installed nw-gyp globally. Then, run the command either in the directory containing node-webkit executables (nwjs), or in a subfolder of that folder.

Running the command should then create a node_modules folder in the same directory as the binaries, containing the sqlite3 module.




回答2:


This helped me to build sqlite3 for Windows 7:

  1. Follow these steps: https://github.com/nodejs/node-gyp/issues/629#issuecomment-138276692
  2. Run your node.js command prompt
  3. Call Setenv.cmd from this solution: https://gist.github.com/kosmobot/6020327

You can download the module itself from Google Drive using this link: /open?id=0B20fPv1V1FfuMFhKLXdHOXNOR28



来源:https://stackoverflow.com/questions/32228226/building-node-sqlite3-with-nw-gyp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!