lsongdev / node-bluetooth

:large_blue_diamond:😬Bluetooth serial port communication for Node.js
https://npmjs.org/node-bluetooth
Other
197 stars 56 forks source link

node-bluetooth causing build error #40

Open James-Machouk opened 5 years ago

James-Machouk commented 5 years ago

Environments :

The problem I was trying to use ESCPOS_2.5.2 when node-gyp start building the ( node-bluetooth ) module, warnings and errors start to pop on the console till

gyp ERR! build error gyp ERR! stack Error: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Users\xxxx\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:196:23) gyp ERR! stack at ChildProcess.emit (events.js:209:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\xxxx\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "build" gyp ERR! cwd D:_Node_field\pos_printer\node_modules\node-bluetooth gyp ERR! node -v v12.9.1 gyp ERR! node-gyp -v v5.0.3 gyp ERR! not ok npm WARN pos_printer@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-bluetooth@1.2.6 (node_modules\node-bluetooth): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-bluetooth@1.2.6 install: node-gyp configure build npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status

is something with the environment causing the problem?

netrevisanto commented 5 years ago

Same problem, please, any advice?

peterpoliwoda commented 4 years ago

In my case there was a quick hack to get it to install xpc-connection, not sure if it's related to your problem, but the current version of xpc does not work with anything over node 8+. See if this helps: npm install git://github.com/taoyuan/node-xpc-connection.git

webkong commented 4 years ago

I think I hava the same problem. pls any repair.

grosseruser commented 4 years ago

...same Problem. After 3 days testing & RTFM.

Environments : Fresh new Windows 10 version 1903 installation Visual Studio Community 2019 / Bulid tools 2017 & 2015 (npm install --global windows-build-tools) Python 2.7.17 node v12.13.0 node-gyp v5.0.3

"npm install node-bluetooth --save --verbose"

... "C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\build\binding.sln" (Standardziel) (1) ->

"C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj" (Standardziel) (2) -> (ClCompile Ziel) -> C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\DeviceINQ.cc(128,72): error C2660: "v8::FunctionTemplate::GetFunction": Funktion akzeptiert keine 0 ArgumenteC:\Users\gross\ AppData\Local\node-gyp\Cache\12.13.0\include\node\v8.h(3457): note: Siehe Deklaration von "v8::Object::Get" [C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcx proj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\DeviceINQ.cc(128,73): error C2661: "v8::Object::Set": Keine überladene Funktion akzeptiert 1 ArgumenteC:\Users\gross\Documen ts\electron\lotse\node_modules\node-bluetooth\src\windows\BTSerialPortBinding.cc(196,1): warning C4996: 'Nan::Callback::Call': wurde als veraltet deklariert [C:\Users\gross\Documents\electron\lotse\node_mod ules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\DeviceINQ.cc(129,72): error C2660: "v8::FunctionTemplate::GetFunction": Funktion akzeptiert keine 0 Argumente [C:\Users\gros s\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\DeviceINQ.cc(129,73): error C2661: "v8::Object::Set": Keine überladene Funktion akzeptiert 1 Argumente [C:\Users\gross\Docum ents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\BTSerialPortBinding.cc(219,82): error C2660: "v8::FunctionTemplate::GetFunction": Funktion akzeptiert keine 0 Argumente [C:\ Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\DeviceINQ.cc(130,72): error C2660: "v8::FunctionTemplate::GetFunction": Funktion akzeptiert keine 0 Argumente [C:\Users\gros s\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\BTSerialPortBinding.cc(219,83): error C2661: "v8::Object::Set": Keine überladene Funktion akzeptiert 1 Argumente [C:\Users\g ross\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\DeviceINQ.cc(130,73): error C2661: "v8::Object::Set": Keine überladene Funktion akzeptiert 1 Argumente [C:\Users\gross\Docum ents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\BTSerialPortBinding.cc(220,82): error C2660: "v8::FunctionTemplate::GetFunction": Funktion akzeptiert keine 0 Argumente [C:\ Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\DeviceINQ.cc(131,72): error C2660: "v8::FunctionTemplate::GetFunction": Funktion akzeptiert keine 0 Argumente [C:\Users\gros s\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\BTSerialPortBinding.cc(220,83): error C2661: "v8::Object::Set": Keine überladene Funktion akzeptiert 1 Argumente [C:\Users\g ross\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\DeviceINQ.cc(131,73): error C2661: "v8::Object::Set": Keine überladene Funktion akzeptiert 1 Argumente [C:\Users\gross\Docum ents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\BTSerialPortBinding.cc(221,82): error C2660: "v8::FunctionTemplate::GetFunction": Funktion akzeptiert keine 0 Argumente [C:\ Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\BTSerialPortBinding.cc(242,39): error C2664: "v8::String::Utf8Value::Utf8Value(const v8::String::Utf8Value &)" : Konvertieru ng von Argument 1 von "v8::Local" in "const v8::String::Utf8Value &" nicht möglich [C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\BTSerialPortBinding.cc(243,41): error C2660: "v8::Value::Int32Value": Funktion akzeptiert keine 0 Argumente [C:\Users\gross\ Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\DeviceINQ.cc(336,39): error C2664: "v8::String::Utf8Value::Utf8Value(const v8::String::Utf8Value &)" : Konvertierung von Arg ument 1 von "v8::Local" in "const v8::String::Utf8Value &" nicht möglich [C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj] C:\Users\gross\Documents\electron\lotse\node_modules\node-bluetooth\src\windows\DeviceINQ.cc(522,57): error C2660: "v8::Function::Call": Funktion akzeptiert keine 3 Argumente [C:\Users\gross\Documents\ele ctron\lotse\node_modules\node-bluetooth\build\BluetoothSerialPort.vcxproj]

49 Warnung(en) 17 Fehler ...

James-Machouk commented 4 years ago

Potential Solution:

this is what i did to make it work

initalize NPM : npm init Install Electron as dev dependencies : npm i -D electron@latest Set this NPM Config :

Install the escpos package : npm install escpos --save Rebuild electron : npm install --save-dev electron-rebuild

please be sure of the path of python & node-gyp ( it may vary on your system )

grosseruser commented 4 years ago

...after 6 days testing I have now a working configuration for escpos. node v11.15.0 electron v5.0.11 electron-rebuild 1.8.5 escpos 2.5.2

Windows build tools: npm install --global --production windows-build-tools Python 2.7.17

tazougphi commented 4 years ago

There might be more going on here, but I had a similar compilation issue and downgrading to Visual Studio 2017 fixed it

edit: I also had to downgrade to NodeJS 11

James-Machouk commented 4 years ago

There might be more going on here, but I had a similar compilation issue and downgrading to Visual Studio 2017 fixed it

edit: I also had to downgrade to NodeJS 11

If you want for any reason to use the latest version of VS Studio and node you can check this solution https://github.com/song940/node-bluetooth/issues/40#issuecomment-547975568

karthikjn01 commented 4 months ago

I'm also running into this issue now, I think it might be a good idea to update the node-bluetooth package version to be compatible?