NW.JS使用node模块serialport串口通信

坑实在是太多啦!

整了一天才摸索出来

真是感慨良多

希望以后用到的人不要再走进坑了

下面说一下nw.js中使用serialport

1.node.js是肯定要装的

2.npm install node-gyp -g  #安装node-gyp

3.npm install node-per-gyp -g #安装node-per-gyp

4.npm install nw-gyp -g #安装nw-gyp

5.npm install --global --production windows-build-tools #这一步会把vs2005和Python2.7一起装了,如果失败只能单独装,教程在

GitHub:https://github.com/nwjs/nw-gyp#readme

6.npm install serialport -g #安装串口通信模块

7.然后命令行cd到serialport下

8.nw-gyp configure --target=x.xx.x(nw版本) #设置配置信息 版本号

9.nw-gyp rebuild --target=x.xx.x --arch=x64 #重新编译 也需要设置版本号 否则失败

10.编译完后把这个模块复制一份到nw.js文件夹下的node_modules就直接可以用了.

到此应该会成功的,

还不行的可以联系我,欢迎交流,互助^^

你可能感兴趣的:(nw.js,nw.js,serialport,node.js)