Git Product home page Git Product logo

Comments (23)

TimelordUK avatar TimelordUK commented on July 26, 2024

Which version of node do you use and do you know if you are on a 32 bit or 64 bit platform. This error means the node JavaScript cannot load the unmanaged dll which is basically the driver which is written in cpp.

Have you written a very simple test program of one file that simply requires library and opens it?

Sent from my iPhone

On 20 Jul 2016, at 10:08, hoavq214 [email protected] wrote:

{
"errorMessage": "None of the binaries loaded successfully. Is your node version either >= 0.12.7 or >= 4.2.x or >= 5.1.1 or >= 6.1.0",
"errorType": "Error",
"stackTrace": [
"Object. (/var/task/node_modules/msnodesqlv8/lib/sqlserver.native.js:24:1)",
"Module._compile (module.js:409:26)",
"Object.Module._extensions..js (module.js:416:10)",
"Module.load (module.js:343:32)",
"Function.Module._load (module.js:300:12)",
"Module.require (module.js:353:17)",
"require (internal/module.js:12:17)",
"Object. (/var/task/node_modules/msnodesqlv8/lib/ConnectionWrapper.js:5:11)"
]
}

I am run on Amazon Lambda.
Please help me. Thank you!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

from node-sqlserver-v8.

hoavq214 avatar hoavq214 commented on July 26, 2024
  1. I have written a example and run on localhost (win 64 bit) and it was running fine with SQL Server Native Client 10.0, though it happening error with SQL Server Native Client 11.0 as below:

Error opening the connection!
{ [Error: [Microsoft][SQL Server Native Client 11.0]SQL Server Native Client 11.0 does not support connections to SQL Server 2000 or earlier versions.] sqlstate: '08001', code: 22 }

  1. I am upload to Amazon Lambda and run try, then get error below:

on Amazon Lambda, version of Node is 4.3

{
"errorMessage": "None of the binaries loaded successfully. Is your node version either >= 0.12.7 or >= 4.2.x or >= 5.1.1 or >= 6.1.0",
"errorType": "Error",
"stackTrace": [
"Object. (/var/task/node_modules/msnodesqlv8/lib/sqlserver.native.js:24:1)", "Module._compile (module.js:409:26)",
"Object.Module._extensions..js (module.js:416:10)",
"Module.load (module.js:343:32)",
"Function.Module._load (module.js:300:12)",
"Module.require (module.js:353:17)",
"require (internal/module.js:12:17)",
"Object. (/var/task/node_modules/msnodesqlv8/lib/ConnectionWrapper.js:5:11)"
]
}

Below is nodejs script i am run successfully on localhost with SQL Server Native Client 10.0

var sql = require('msnodesqlv8');
var conn_str = "Driver={SQL Server Native Client 10.0};Server=118.70.81.46;Database=test;Uid=sa;Pwd=sa;Encrypt={No};Trusted_Connection={No};useUTC={True}";
sql.open(conn_str, function (err, conn) {
if (err) {
console.log('Error opening the connection!');
console.log(err);
return;
}
conn.queryRaw('SELECT TOP 1000 [CAT_ID] ,[車輌番号] FROM [test].[dbo].[DEL_LIST]', function (err, results) {
if (err) {
console.log('Error running query!');
return;
}
for (var i = 0; i < results.rows.length; i++) {
console.log('CAT_ID: ' + results.rows[i][0] + ' - 車輌番号:' + results.rows[i][1]);
}
});
});

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

have you installed the VS 2015 C++ runtime on your target host?

https://www.microsoft.com/en-gb/download/details.aspx?id=48145

the driver will not load without the c++ redistributable.

from node-sqlserver-v8.

bfarmilo avatar bfarmilo commented on July 26, 2024

Hi, I've been struggling with the same error message ("none of the binaries loaded ...") but only when trying to call the module from electron. It works perfectly when I run it in node from the command line. I've installed the same version of node as the one provided in electron (node 6.3.0) and have no problem building the msnodesqlv8 driver. I run my test script using node -- works great. I cut-and-paste the exact same code and run it from within electron -- "none of the binaries ...". I can't seem to find anything on this, I think it has to do with how I'm configuring electron but I'm hoping if I put this out here I might get someone else struggling with the same issue. Any tips or ideas are welcome, thanks !

The database is simply a LocalDB and my connection string is (it's a string so \ are escaped)
"Driver={SQL Server Native Client 11.0};Server={(LocalDB)\\v11.0};Database=C:\\xxx-Project\\Server\\bin\\xxx_LicensingDB1.mdf;Integrated Security=True; Connect Timeout=150;MultipleActiveResultSets=True;App=EntityFramework;"

here's the script that fails on the require('msnodesqlv8') line.

module.exports = query;
// takes arguments (WHEREstring, VALUESarray, callback), returns callback(error, array containing query results)
var sql = require('msnodesqlv8');
var DB = require('./app_config.json').patentDB;
// the main query code
function query(whereString, values, callback) {
    // open a connection to the database
    sql.open(DB.connection, function (err, conn) {
        if (err) {
            console.log("Error opening the connection!");
            return callback(err);
        }
        console.log("Good connection to:", DB.connection.slice(DB.connection.indexOf("Server="), DB.connection.indexOf(";Integrated")));
        // good connection, so query the DB and return the callback when done
        console.log("Attempting Query: " + DB.selectString + whereString + DB.orderString, values);
        conn.queryRaw(DB.selectString + whereString + DB.orderString, values, function (err2, data) {
            if (err2) {
                console.log("Error with the Query!", DB.selectString + whereString + DB.orderString, values);
                return callback(err2);
            } else {
                return callback(null, data.rows);
            };
        }); //queryRaw
    }); // connection to DB
}; // the query code

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

Ok I have very little knowledge of running inside electron so I will have to set up a little test harness. Out of interest how many times is the require statement executed to driver. Are you seeing the first call succeed and others fail? Or is it simply the first call. Can you put a print or debug to see.

Sent from my iPad

On 3 Aug 2016, at 19:59, bfarmilo [email protected] wrote:

Hi, I've been struggling with the same error message ("none of the binaries loaded ...") but only when trying to call the module from electron. It works perfectly when I run it in node from the command line. I've installed the same version of node as the one provided in electron (node 6.3.0) and have no problem building the msnodesqlv8 driver. I run my test script using node -- works great. I cut-and-paste the exact same code and run it from within electron -- "none of the binaries ...". I can't seem to find anything on this, I think it has to do with how I'm configuring electron but I'm hoping if I put this out here I might get someone else struggling with the same issue. Any tips or ideas are welcome, thanks !

The database is simply a LocalDB and my connection string is (it's a string so \ are escaped)
"Driver={SQL Server Native Client 11.0};Server={(LocalDB)\v11.0};Database=C:\xxx-Project\Server\bin\xxx_LicensingDB1.mdf;Integrated Security=True; Connect Timeout=150;MultipleActiveResultSets=True;App=EntityFramework;"

here's the script that fails on the require('msnodesqlv8') line.

module.exports = query;
// takes arguments (WHEREstring, VALUESarray, callback), returns callback(error, array containing query results)
var sql = require('msnodesqlv8');
var DB = require('./app_config.json').patentDB;
// the main query code
function query(whereString, values, callback) {
// open a connection to the database
sql.open(DB.connection, function (err, conn) {
if (err) {
console.log("Error opening the connection!");
return callback(err);
}
console.log("Good connection to:", DB.connection.slice(DB.connection.indexOf("Server="), DB.connection.indexOf(";Integrated")));
// good connection, so query the DB and return the callback when done
console.log("Attempting Query: " + DB.selectString + whereString + DB.orderString, values);
conn.queryRaw(DB.selectString + whereString + DB.orderString, values, function (err2, data) {
if (err2) {
console.log("Error with the Query!", DB.selectString + whereString + DB.orderString, values);
return callback(err2);
} else {
return callback(null, data.rows);
};
}); //queryRaw
}); // connection to DB
}; // the query code

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

from node-sqlserver-v8.

bfarmilo avatar bfarmilo commented on July 26, 2024

Thanks for your help ! Background-wise I'm running windows 10 Home version 1511 build 10586.494

It fails on the first call, here is the error that electron throws:

image

I'll also try using electron-rebuild to build the drivers again and see if I get any additional error messages.

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

I'm not at a terminal right now. It would be interesting to check the JavaScript is actually trying to load the driver. In lib folder there is file called sqlserver.native.js. Can you put a log in the loop where it enumerates all drivers and tries to load each one. To make sure the bootstrap is running the same in electron

Sent from my iPhone

On 3 Aug 2016, at 20:27, bfarmilo [email protected] wrote:

Thanks for your help ! Background-wise I'm running windows 10 Home version 1511 build 10586.494

It fails on the first call, here is the error that electron throws:

I'll also try using electron-rebuild to build the drivers again and see if I get any additional error messages.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

from node-sqlserver-v8.

bfarmilo avatar bfarmilo commented on July 26, 2024

OK Thanks I'll give it a try

from node-sqlserver-v8.

bfarmilo avatar bfarmilo commented on July 26, 2024

Dang. Meanwhile I reinstalled and now it won't build with a 'binding.gyp not found' error. In the meantime I'll still put in that log and see where it fails.

...
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\Users\\Bill\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\xxx-Project\\DBViewerApp\\app\\node_modules\\msnodesqlv8\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Bill\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Bill\\.node-gyp\\6.3.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Bill\\.node-gyp\\6.3.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Bill\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\xxx-Project\\DBViewerApp\\app\\node_modules\\msnodesqlv8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\xxx-Project\\DBViewerApp\\app\\node_modules\\msnodesqlv8\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: C:\xxx-Project\DBViewerApp\app\node_modules\msnodesqlv8) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\Bill\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Bill\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gy
p.js" "clean" "configure" "build" "--verbose"
gyp ERR! cwd C:\xxx-Project\DBViewerApp\app\node_modules\msnodesqlv8
gyp ERR! node -v v6.3.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
The system cannot find the path specified.

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

in the install folder copy bindingdotgyp.old to binding.gyp and try again.

this is a bit of a hack to prevent npm from building the driver when npm installl is invoked - I need to investigate how to prevent npm from doing this.

from node-sqlserver-v8.

bfarmilo avatar bfarmilo commented on July 26, 2024

OK, build works, thanks for the tip.

Error still persists unfortunately, here is the log I inserted:

function liveLoad() {
    var binaryDir = __dirname + '/bin/';
    var files = require('fs').readdirSync(binaryDir);
    console.log("msnodesqlv8 looking in", binaryDir);
    files.forEach(function (file) {
        console.log("msnodesqlv8 trying file:", file);
        console.log("noBinaryExported:", noBinaryExported())
        if (noBinaryExported()) attemptToExportBinary(file);
    });
    failIfNoBinaryExported();
...

and the resulting error. I can also report 'attemptToExporBinary(file)' generated an error each time (logged it later but didn't cut/paste result).

PS C:\xxx-Project\DBViewerApp\app> electron main.js

msnodesqlv8 looking in C:\xxx-Project\DBViewerApp\app\node_modules\msnodesqlv8\lib/bin/
msnodesqlv8 trying file: sqlserverv8.v0.12.15.ia32.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.v0.12.15.x64.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.v4.4.5.ia32.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.v4.4.5.x64.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.v5.12.0.ia32.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.v5.12.0.x64.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.v6.2.2.ia32.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.v6.2.2.x64.node
noBinaryExported: true
App threw an error during load
Error: None of the binaries loaded successfully. Is your node version either >= 0.12.7 or >= 4.2.x or >= 5.1.1 or >= 6.1.0
    at failIfNoBinaryExported (C:\xxx-Project\DBViewerApp\app\node_modules\msnodesqlv8\lib\sqlserver.native.js:53:39)
    at liveLoad (C:\xxx-Project\DBViewerApp\app\node_modules\msnodesqlv8\lib\sqlserver.native.js:43:5)
    at Object.<anonymous> (C:\xxx-Project\DBViewerApp\app\node_modules\msnodesqlv8\lib\sqlserver.native.js:23:1)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

OK thanks for additional information. I will install electron and attempt to reproduce your issue.

When you say you managed to build the package, do you know where node-gyp as put your locally compiled binary? One more experiment would be for example to add your new locally built binary into the folder to see if it loads this one rather than one of the ones I provide. You could even hack the script to attempt to load yours as we know the others dont work anyway.

are you using 64 bit or 32 bit platform?

Clearly this needs more investigation - I will check the closed issues as I am sure someone has raised something very similar with electron before ....

#22

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

I will shortly add binaries for electron, but I got this to work OK.

you are right, the standard node binaries will not load.

npm install msnodesqlv8
cd msnodesqlv8
copy bindingdotgyp.old binding.gyp
node-gyp rebuild --target=1.3.2 --dist-url=https://atom.io/download/atom-shell
copy build/Release/sqlserverv8.node lib/bin

then run your electron app.

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

https://github.com/TimelordUK/node-sqlserver-v8/releases

note if you have not already done so, the latest npm version of this driver should work out the box with the latest electron if you wish to give it a try.

from node-sqlserver-v8.

bfarmilo avatar bfarmilo commented on July 26, 2024

Outstanding !!!

Thanks for your help, works beautifully !

from node-sqlserver-v8.

durtal avatar durtal commented on July 26, 2024

Hi @TimelordUK, I am having the same issues as this thread, but I am using msnodesqlv8 as the driver within the mssql package, so my config file looks like:

var config = {
    driver: 'msnodesqlv8',
    server: 'example1234',
    database: 'AdventureWorks2012',
    options: {
        trustedConnection: true
    }
}

Just as @bfarmilo found, if I put code connecting and querying in a separate file and run node query.js then it works fine but within an electron app I get the same errors.

I have tried your suggestions in this thread but with no luck, though it's entirely possible I have got very muddled, your latest comment

https://github.com/TimelordUK/node-sqlserver-v8/releases

note if you have not already done so, the latest npm version of this driver should work out the box with the latest electron if you wish to give it a try.

made me think it would/should just be a case of running npm install mssql msnodesqlv8 and that'd be it, I did try the steps in the release where you mention electron:

 npm install msnodesqlv8
 cd msnodesqlv8
 npm install electron-prebuilt
 tool\build-electron.bat

but when I run tool\build-electron.bat I get MySQL is not recognised as an internal or external command or sometimes node is not a recognised....

Any help would be greatly appreciated. I am using Windows 10, node 6.7.0, electron 1.4.3.
Many thanks

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

The driver should now ship with binaries for electron. It seems like you are picking up an older version as the node version is working. I have not yet tried mssql msnodesqlv8 and electron yet but will do so.

Please check on your file system that you have the current version installed and this is the one being used by mssql. If you look in the bin folder you should see the electron versions of the binary. Is it possible to debug or add a log statement in the live load function as above.

Also is it possible to write a little test script that only uses electron and this library. I am not at my terminal currently but can create one later for you if necessary.

It is always worth starting from simplest point that we know works and going from there.

I will check the library against the latest electron to ensure it is still working.

from node-sqlserver-v8.

durtal avatar durtal commented on July 26, 2024

Hi @TimelordUK, thanks so much for your quick reply!

I have created a repo with a simple project. The electron app is the electron-quick-start app, untouched apart from installing mssql and msnodesqlv8. I have also explained errors, etc (as best I can) in the README.

I have included the msnodesqlv8 in the repo and it does appear (I think - 🙈) as though I am installing the most recent version (with electron binaries). I added code to the liveLoad function as above and got the following:

$ npm start

> [email protected] start C:\Users\TomHeslop\Desktop\electron\electron-test
> electron .

msnodesqlv8 looking in C:\Users\TomHeslop\Desktop\electron\electron-test\node_modules\msnodesqlv8\lib/bin/
msnodesqlv8 trying file: sqlserverv8.electron.v1.3.2.ia32.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.electron.v1.3.2.x64.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.node.v0.12.15.ia32.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.node.v0.12.15.x64.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.node.v4.5.0.ia32.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.node.v4.5.0.x64.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.node.v5.12.0.ia32.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.node.v5.12.0.x64.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.node.v6.6.0.ia32.node
noBinaryExported: true
msnodesqlv8 trying file: sqlserverv8.node.v6.6.0.x64.node
noBinaryExported: true
App threw an error during load
Error: None of the binaries loaded successfully. Is your node version either >= 0.12.7 or >= 4.2.x or >= 5.1.1 or >= 6.1.0
    at failIfNoBinaryExported (C:\Users\TomHeslop\Desktop\electron\electron-test\node_modules\msnodesqlv8\lib\sqlserver.native.js:69:19)
    at liveLoad (C:\Users\TomHeslop\Desktop\electron\electron-test\node_modules\msnodesqlv8\lib\sqlserver.native.js:56:5)
    at Object.<anonymous> (C:\Users\TomHeslop\Desktop\electron\electron-test\node_modules\msnodesqlv8\lib\sqlserver.native.js:24:1)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)

Hope you can help out, but don't worry otherwise, I've got the feeling I'm trying to run before I can walk 😄

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

thanks for the test - you are quite correct there is an issue with electron 1.4. I will get a release done very shortly to remedy this issue.

from node-sqlserver-v8.

durtal avatar durtal commented on July 26, 2024

Hi @TimelordUK there is no rush, thanks for replying.

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

no problem, I do not like to leave a broken system out there, appreciate you bringing it to my attention. The latest version 0.2.10 should work OK now, I do not see this error when running your test against latest.. With node, the system usually works through any minor update version of Node, for some reason my electron build broke even with a minor electron update.

from node-sqlserver-v8.

durtal avatar durtal commented on July 26, 2024

Works a charm, many thanks for sorting so quickly!

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on July 26, 2024

I think this particular thread can now be closed.

from node-sqlserver-v8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.