微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

node-gyp编译node-sqlserver转载


1. 下载安装node

      (win8 2503错误:应该用管理员权限安装node.msi (cmd-> msiexec /package “你的安装文件的全路径”))

2. 安装node-gyp

npm install node-gyp -g

3. 获取node-sqlserver,v8,libuv源代码

git clone https://github.com/WindowsAzure/node-sqlserver.git
git clone https://github.com/v8/v8.git
git clone https://github.com/joyent/libuv

4. 修改node-sqlserver的binding.gyp文件

'include_dirs': [

       'src','指向/v8/include','指向/libuv/include'

     ],

5. node-gyp configure( 应该进入到node-sqlserver 目录 )

6. node-gyp build

7. 将lib/sql.js和node-sqlserver.node 复制到任意目录

var sql=require('./sql.js');

var con=sql.open("Driver={sql Server Native Client 10.0};Server=(local)\\sqlexpress;Database=c9;Trusted_Connection={Yes}",function(e){

       con.queryRaw('select * from departments',function(e,r){

           console.log(r);

   });

});

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐