Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serialport + nodewebkit version 0.10.2 #374

Closed
redramster opened this issue Aug 25, 2014 · 42 comments
Closed

serialport + nodewebkit version 0.10.2 #374

redramster opened this issue Aug 25, 2014 · 42 comments

Comments

@redramster
Copy link

I am trying to work with node-webkit's latest version which is built on nodes 0.11.13
I understand from your comment that there is a problem but I was not sure on its nature. However, I was able to compile serialport using nw-pre-gyp but when I try to use it (require("serialport") I get the following error:
Error: The specified procedure could not be found.
d:\Edu Quest (x86)\node_modules\serialport\build\serialport.node
message: "The specified procedure could not be found.
↵d:\Edu Quest (x86)\node_modules\serialport\build\serialport.node"
stack: "Error: The specified procedure could not be found.
↵d:\Edu Quest (x86)\node_modules\serialport\build\serialport.node↵ at Error (native)↵ at Module.load (module.js:352:32)↵ at Function.Module._load (module.js:308:12)↵ at Module.require (module.js:360:17)↵ at require (module.js:376:17)↵ at Object. (D:\Edu Quest (x86)\node_modules\serialport\serialport.js:12:25)↵ at Module._compile (module.js:452:26)↵ at Object.Module._extensions..js (module.js:470:10)↵ at Module.load (module.js:352:32)↵ at Function.Module._load (module.js:308:12)"

I tried to compile using nodes 0.11.10 using nw-pre-gyp. compile was successful, but I still get the same error.

Is there any workaround?
Thanks
Ramster

@tadjik1
Copy link

tadjik1 commented Aug 26, 2014

I have the same error on MacOS 64-bit. I catch the error bellow:

Error: Cannot find module '/Users/user/projects/test/node_modules/serialport/build/serialport/v1.4.5/Release/node-webkit-v13-darwin-ia32/serialport.node'
    at Function.Module._resolveFilename (module.js:334:15)
    at Function.Module._load (module.js:273:25)
    at Module.require (module.js:360:17)
    at require (module.js:376:17)
    at Object.eval (/Users/user/projects/test/node_modules/serialport/serialport.js:14:25)
    at Module._compile (module.js:452:26)
    at Object.Module._extensions..js (module.js:470:10)
    at Module.load (module.js:352:32)
    at Function.Module._load (module.js:308:12)
    at Module.require (module.js:360:17)

and into build folder I see the other version of build - node-v11-darwin-x64

@redramster
Copy link
Author

I got the same, but I changed the folders to match what he was looking for and got the above error (i.e. it can find it, but its not compatible)

@tadjik1
Copy link

tadjik1 commented Aug 27, 2014

I found an article:

https://github.com/rogerwang/node-webkit/wiki/Build-native-modules-with-nw-gyp

using

$ npm install node-pre-gyp
$ node-pre-gyp build --runtime=node-webkit --target=0.10.2

I make a needed version which place in node_modules/serialport/build/serialport/v1.4.5/Release/node-webkit-v0.10.2-darwin-x64/

when I try to create app and launch it I catch the error - app try to load this package from other dir - node-webkit-v14.

@redramster
Copy link
Author

are you able to compile with -runtime=node-webkit and --target=0.10.2
I get alot of errors from the node-pre-gyp.
you can use the other options in node-pre-gyp to configure your target. Also, I am not sure but node-webkit for windows only support 32bit, so compiling with 64bit seems like a problem.
I am guessing here :(

@Mithgol
Copy link

Mithgol commented Aug 31, 2014

README.md currently says that serialport does not support Node.js version 0.11.11 or newer.

On the other hand, node-webkit 0.10.2 is based on Node.js v0.11.13.

You should probably try another target, such as node-webkit v0.8.6.

@Mithgol
Copy link

Mithgol commented Aug 31, 2014

On the gripping hand, someone should really write a pull request that alters .travis.yml and appveyor.yml and thus starts building and publishing of serialport binaries for node-webkit in addition to the currently built and published binaries for Node.js.

@redramster
Copy link
Author

the problem is that I also need the full screen video capability that the 0.10.2 supports (and the 0.8.6) does not. When I try to use the complied serialport from v0.8.6 I get the "can't find procedure" error mentioned above. Are there any plans to support the 0.11.13 version? Can you shed a light on why this is'nt compiling and what is the barrier to support the 0.11.13. I may be able to contribute and solve the issues...

@Mithgol
Copy link

Mithgol commented Aug 31, 2014

Somehow I can't explain this lack of support — even to myself.

Because, look, currently serialport seems to use version 1.3.0 of the nan package since ddd3c04.

That nan's version is known (since May 2014!) to not support Node 0.11 versions prior to 0.11.13, but supports newer versions (i.e. it supports Node.js 0.11.13, which is precisely the version node-webkit 0.10.2 is based on).

However, serialport's README.md contradicts that statement.

Something's clearly wrong here.

@tadjik1
Copy link

tadjik1 commented Aug 31, 2014

Ok, finally it works for me. I make the following:

  1. Install yeoman generator and create new project

  2. Change all files in node-webkit folder (because old version nw is used in generator) - so I have a generator with node-webkit 0.10.2 (MacOS 64-bit)

  3. Install serialport library via npm (npm i serialport)

  4. Rebuild serialport using commands bellow:

    $ npm install node-pre-gyp
    $ node-pre-gyp build --runtime=node-webkit --target=0.3.3
    

    more info here - https://github.com/rogerwang/node-webkit/wiki/Build-native-modules-with-nw-gyp

After that steps it works fine in my system (correctly build and run)

@Mithgol
Copy link

Mithgol commented Aug 31, 2014

Suppose that serialport's README.md is wrong. Having supposed that, we must in turn suppose that node-webkit 0.10.2 is actually supported.

If that's true, then why exactly has @tadjik1 got a folder named node-webkit-v0.10.2-darwin-x64 and why the app tried to load it from a different folder (node-webkit-v14)?

Currently serialport depends on node-pre-gyp version 0.5.x, declared as a bundled dependency, which is correct.

By running npm install serialport on my machine I can confirm that the bundled version of node-preg-gyp is v0.5.19.

Now let's go further to the source code: node-pre-gyp became v0.5.19 in the commit mapbox/node-pre-gyp@fa59fdc, and its source code is in the following state after that commit:

  • package.json declares ./lib/node-pre-gyp.js as the main file
  • there the method .find (used to find a binary) is exported from ./pre-binding (i.e. /lib/pre-binding.js)
  • /lib/pre-binding.js uses versioning.evaluate to get module_path and module_name
  • /lib/util/versioning.js uses (process.versions['node-webkit'] ? 'node-webkit' : 'node') to take the runtime's name into account
  • the node_abi property is filled by the function get_node_abi that receives the runtime parameter and thus should use 'node-webkit' in the folder's name
  • it then adds the '-v' part and the ABI version

And it explains why @tadjik1 observed the app trying a folder node-webkit-v14.

Then why the commands npm install node-pre-gyp and node-pre-gyp build --runtime=node-webkit --target=0.10.2 (run by @tadjik1) resulted in a build in a different folder (node-webkit-v0.10.2-darwin-x64 folder)?

That's because the npm install node-pre-gyp does not install node-preg-gyp version 0.5.19. It installs the newest version (node-pre-gyp v0.5.23) that has a different naming convention (it now uses '-nw' and node-webkit's version instead of '-v' and Node.js ABI version).

Who did this change? That was me in mapbox/node-pre-gyp@53f3e38.

I had a good reason for this change: node-webkit's ABI changes in every node-webkit's version, and thus Node.js ABI version is irrelevant.

Serialport's bundled node-preg-gyp should be upgraded, that's all.

@redramster
Copy link
Author

following your very helpful explanation I have upgraded the node-pre-gyp version in serial port. however trying to build it I got build errors:
I used: node-pre-gyp build --runtime=node-webkit --target=0.10.2
and got:
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
serialport.cpp
serialport_win.cpp
enumser.cpp
..\src\serialport.cpp(75): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char*(char _)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport.cpp(156): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char_(char _)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport.cpp(224): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char_(char _)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport.cpp(263): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char_(char _)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport.cpp(329): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char_(char _)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport.cpp(379): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char_(char *)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport_win.cpp(254): error C2039: 'New' : is not a member of 'v8::String' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
C:\Users\rama.nw-gyp\0.10.2\deps\v8\include\v8.h(1665) : see declaration of 'v8::String'
..\src\serialport_win.cpp(254): error C3861: 'New': identifier not found [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
Failed to execute 'nw-gyp.cmd configure build --name=serialport --configuration=Release --module_name=serialport --version=1.4.5 --major=1 --minor=4 --patch=5 --runtime=node-webkit --node_abi=node-webkit-v0.10.2 --target=0.10.2 --platform=win32 --target_platform=win32 --arch=ia32 --target_arch=ia32 --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport\v1.4.5\Release\node-webkit-v0.10.2-win32-ia32 --module=c:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport\v1.4.5\Release\node-webkit-v0.10.2-win32-ia32\serialport.node --remote_path=./serialport/v1.4.5/Release/ --package_name=node-webkit-v0.10.2-win32-ia32.tar.gz --staged_tarball=build\stage\serialport\v1.4.5\Release\node-webkit-v0.10.2-win32-ia32.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v1.4.5/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v1.4.5/Release/node-webkit-v0.10.2-win32-ia32.tar.gz' (1)

@redramster
Copy link
Author

tadjik1, you write target=0.3.3 ? is that what you used? which node-webkit version are you working with.
if it is working for you on 0.10.2, can you please upload your .node file?

@Mithgol
Copy link

Mithgol commented Aug 31, 2014

@redramster By the way, what is the tool that you use to build the addon? (Microsoft Visual Studio Express 2010, Visual Studio Express 2013 for Windows Desktop, anything else?)

I am asking this because we have yet another contradiction in READMEs:

@Mithgol
Copy link

Mithgol commented Aug 31, 2014

if it is working for you on 0.10.2, can you please upload your .node file?

That won't help. Platform differences. He has said he's building for MacOS 64-bit, while you're on Windows.

@redramster
Copy link
Author

of course you are right :(
I am using node-pre-gyp. I have both 2010 and 2013 installed on my machine. can I set the vs that node-pre-gyp uses?

@Mithgol
Copy link

Mithgol commented Aug 31, 2014

I suppose you could use the --msvs_version=2012 switch mentioned in nodejs/node-gyp#172 in 2012. Because nw-gyp is a fork of node-gyp, and because node-pre-gyp should just pass any parameter from its command line to one of them unless node-pre-gyp recognizes it as one of its own.

(In your case that would be --msvs_version=2010 or --msvs_version=2013 I guess.)

@Mithgol
Copy link

Mithgol commented Aug 31, 2014

However, that --msvs_version=… switch is not documented anywhere (except the source code, of course).

That's bad because it means I couldn't search for it in nw-gyp (GitHub does not support searches in the source code of a forked repository).

@redramster
Copy link
Author

Thanks. I tried it, but still can't compile.

@tadjik1
Copy link

tadjik1 commented Sep 1, 2014

please sorry, it's my typo. I wrote current version, 0.10.2

try to execute next steps:

$ npm install -g nw-gyp
$ nw-gyp configure --target=0.10.2
$ nw-gyp build

and if you catch an error then run node-pre-gyp.

and read this - https://github.com/rogerwang/node-webkit/wiki/Build-native-modules-with-nw-gyp

@kraag22
Copy link

kraag22 commented Sep 8, 2014

I'm trying to make this work on Mac & Win with node webkit 0.10.4
I have no problem build serialport 1.4.6 on mac with

node-pre-gyp rebuild --runtime=node-webkit --target=0.10.4 --target_arch=ia32

But on windows it is different. I cannot use nw-gyp nor node-pre-gyp. Both of them are failing on

snimek obrazovky 2014-09-09 v 9 42 57

@Mithgol
Copy link

Mithgol commented Sep 8, 2014

@kraag22 Though the screenshot does not contain a full log, the invalid syntax error might be caused by a Python's version mismatch. (Check if Python v2.7 is used on your Windows; Python 3.x isn't supported by Node-related gyp tools.)

@kraag22
Copy link

kraag22 commented Sep 9, 2014

@Mithgol thanks for answer. I looked, that nw-gyp recommends python 2.7.3. I have 2.7.5 version installed on my Windows. I also updated image with log, so now is complete.

Maybe there is some problem with version of nw-gyp. In screenshot command "nw-gyp -v" returns "v0.7.3-4", but when I try it directly in command line, it correctly returns newest version number "v0.12.2"

@kraag22
Copy link

kraag22 commented Sep 9, 2014

@Mithgol it was because old version of nw-gyp was used. After I used 0.12.2, it was OK. I needed to use node-pre-gyp.

So node webkit 0.10.4 can work with node serialport 1.4.6 both on windows and mac. Only problem is, that I need to manually rename released version. (directories have wrong versions - node.js version vs. node-webkit version) mapbox/node-pre-gyp#104

@redramster
Copy link
Author

hey kraag22
I followed your path (python 2.7.3 nw-gyp v0.12.2 but was not able to compile. got the following error log (see below)
can you upload your serialport.node for windows?
Many thanks for all the help

Ramster

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
serialport.cpp
serialport_win.cpp
enumser.cpp
..\src\serialport.cpp(75): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char*(char _)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport.cpp(156): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char_(char _)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport.cpp(224): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char_(char _)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport.cpp(263): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char_(char _)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport.cpp(329): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char_(char _)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport.cpp(379): warning C4344: behavior change: use of explicit template arguments results in call to 'v8::Local NanNewv8::String,char_(char *)' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
with
[
T=v8::String
]
but the regular function 'v8::Local NanNew(const char *,int)' is a better match
with
[
T=v8::String
]
if you expect 'v8::Local NanNew(const char *,int)' to be called then you need to make it an explicit specialization
with
[
T=v8::String
]
..\src\serialport_win.cpp(254): error C2039: 'New' : is not a member of 'v8::String' [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]
C:\Users\rama.nw-gyp\0.10.4\deps\v8\include\v8.h(1665) : see declaration of 'v8::String'
..\src\serialport_win.cpp(254): error C3861: 'New': identifier not found [C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport.vcxproj]

Failed to execute 'nw-gyp.cmd rebuild --name=serialport --configuration=Release --module_name=serialport --version=1.4.5 --major=1 --minor=4 --patch=5 --runtime=node-webkit --node_abi=node-webkit-v0.10.4 --target=0.10.4 --platform=win32 --target_platform=win32 --arch=ia32 --target_arch=ia32 --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=C:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport\v1.4.5\Release\node-webkit-v0.10.4-win32-ia32 --module=c:\Program Files (x86)\nodejs\node_modules\serialport\build\serialport\v1.4.5\Release\node-webkit-v0.10.4-win32-ia32\serialport.node --remote_path=./serialport/v1.4.5/Release/ --package_name=node-webkit-v0.10.4-win32-ia32.tar.gz --staged_tarball=build\stage\serialport\v1.4.5\Release\node-webkit-v0.10.4-win32-ia32.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v1.4.5/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v1.4.5/Release/node-webkit-v0.10.4-win32-ia32.tar.gz --msvs_version=2010' (1)

@rosterloh
Copy link

I am having the same issue. I managed to get this to build correctly for nw v0.10.4 with

  $ node-pre-gyp rebuild --runtime=node-webkit --target=0.10.4 --target_arch=ia32

and for v0.8.6 with

  $ node-pre-gyp rebuild --runtime=node-webkit --target=0.8.6 --target_arch=ia32

both of these work with providing the list of available serial ports but I cannot open a port. I always get Access denied error.
This is on Windows 7 with node v0.10.31

@voodootikigod
Copy link
Collaborator

This ticket has grown out of control and seems to have taken a definitive passive aggressive to aggressive aggressive stance. Would it be fair enough to sum up this ticket with #383 in that the issue is getting node-serialport and node-webkit (and their respective dependencies) working OOTB?

@voodootikigod
Copy link
Collaborator

Couple of follow ups just to make sure everyone is on the same page, please add tickets under these assumptions:

  • Latest node-serialport, version 1.4.6, is compiled with the latest node-pre-gyp (0.5.x) and NAN (1.3.0)
  • Originally when pushed, 1.4.6 would break on 0.11.x node.js due to a part of NAN that exposed a bug in Node.js see: Abort on node v0.11.13 Level/leveldown#105 that has since been fixed here nodejs/node-v0.x-archive@81a9739 and should now work with 0.11.x that includes that commit.
  • As best I can tell from the stream, there is a incompatibility between node-gyp and nw-gyp. I know this has been solved, not sure where at the moment.

Can someone please verify that the current version still exhibits the issue and exactly what and how to reproduce with code sample ideally the issue.

thank you - Chris

@konsumer
Copy link

I can verify (see the other issue for more info.)

Basically, I use this tester

I do this to make it work on mac:

npm install
cd node_modules/serialport/

Then, I need to run node-pre-gyp & move files (because they are in the wrong directory.)

with ia32 runtime:

node-pre-gyp rebuild --runtime=node-webkit --target=0.11.2  --target_arch=ia32
mv node_modules/serialport/build/serialport/v1.4.6/Release/node-webkit-v0.11.2-darwin-ia32/ node_modules/serialport/build/serialport/v1.4.6/Release/node-webkit-v14-darwin-ia32

or x64 runtime:

node-pre-gyp rebuild --runtime=node-webkit --target=0.11.2  
mv node_modules/serialport/build/serialport/v1.4.6/Release/node-webkit-v0.11.2-darwin-x64/ node_modules/serialport/build/serialport/v1.4.6/Release/node-webkit-v14-darwin-x64

Both work fine.

@matthova
Copy link

@konsumer That was awesome. Thank you!
Mac works. On to windows

@mike1808
Copy link

HI. I faced this issue too.
Here is my logs and versions
node - v0.12.0
node-pre-gyp - v0.6.4
serialport - 1.5.0
nw.js - v0.11.5

Here is my log from npm

$ node-pre-gyp rebuild --runtime=node-webkit --target=0.11.2  --msvs_version=2013
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.4
node-pre-gyp info using node@0.12.0 | win32 | x64
gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.2
gyp info using node@0.12.0 | win32 | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using nw-gyp@0.12.4
gyp info using node@0.12.0 | win32 | x64
child_process: customFds option is deprecated, use stdio instead.
gyp info spawn python
gyp info spawn args [ 'c:\\Users\\Michael\\AppData\\Roaming\\npm\\node_modules\\nw-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=2013',
gyp info spawn args   '-I',
gyp info spawn args   'd:\\projects\\serialport-nw-tester\\node_modules\\serialport\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'c:\\Users\\Michael\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'c:\\Users\\Michael\\.nw-gyp\\0.11.2\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=c:\\Users\\Michael\\.nw-gyp\\0.11.2',
gyp info spawn args   '-Dmodule_root_dir=d:\\projects\\serialport-nw-tester\\node_modules\\serialport',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'd:\\projects\\serialport-nw-tester\\node_modules\\serialport\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using nw-gyp@0.12.4
gyp info using node@0.12.0 | win32 | x64
child_process: customFds option is deprecated, use stdio instead.
gyp info spawn C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  serialport.cpp
  serialport_win.cpp
  enumser.cpp
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(200): error C2039: 'SetCounterFunction' : is not a member of 'v8::V8' (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modules\serialp ort\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(200): error C2039: 'SetCounterFunction' : is not a member of 'v8::V8' (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_modules\ser ialport\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(200): error C3861: 'SetCounterFunction': identifier not found (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modules\serialport\buil d\serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(200): error C3861: 'SetCounterFunction': identifier not found (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_modules\serialport\ build\serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(205): error C2039: 'SetCreateHistogramFunction' : is not a member of 'v8::V8' (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modules \serialport\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(205): error C2039: 'SetCreateHistogramFunction' : is not a member of 'v8::V8' (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_mod ules\serialport\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(205): error C3861: 'SetCreateHistogramFunction': identifier not found (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modules\serialp ort\build\serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(205): error C3861: 'SetCreateHistogramFunction': identifier not found (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_modules\ser ialport\build\serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(210): error C2039: 'SetAddHistogramSampleFunction' : is not a member of 'v8::V8' (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modu les\serialport\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(210): error C2039: 'SetAddHistogramSampleFunction' : is not a member of 'v8::V8' (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_ modules\serialport\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(210): error C3861: 'SetAddHistogramSampleFunction': identifier not found (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modules\seri alport\build\serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(210): error C3861: 'SetAddHistogramSampleFunction': identifier not found (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_modules\ serialport\build\serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(214): error C2039: 'IdleNotification' : is not a member of 'v8::V8' (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modules\serialpor t\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(214): error C2039: 'IdleNotification' : is not a member of 'v8::V8' (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_modules\seria lport\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(214): error C3861: 'IdleNotification': identifier not found (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modules\serialport\build\ serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(214): error C3861: 'IdleNotification': identifier not found (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_modules\serialport\bu ild\serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(218): error C2039: 'LowMemoryNotification' : is not a member of 'v8::V8' (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modules\seri alport\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(218): error C2039: 'LowMemoryNotification' : is not a member of 'v8::V8' (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_modules\ serialport\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(218): error C3861: 'LowMemoryNotification': identifier not found (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modules\serialport\b uild\serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(218): error C3861: 'LowMemoryNotification': identifier not found (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_modules\serialpo rt\build\serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(222): error C2039: 'ContextDisposedNotification' : is not a member of 'v8::V8' (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_module s\serialport\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(222): error C2039: 'ContextDisposedNotification' : is not a member of 'v8::V8' (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_mo dules\serialport\build\serialport.vcxproj]
          c:\Users\Michael\.nw-gyp\0.11.2\deps\v8\include\v8.h(4699) : see declaration of 'v8::V8'
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(222): error C3861: 'ContextDisposedNotification': identifier not found (..\src\serialport.cpp) [d:\projects\serialport-nw-tester\node_modules\serial port\build\serialport.vcxproj]
d:\projects\serialport-nw-tester\node_modules\serialport\node_modules\nan\nan.h(222): error C3861: 'ContextDisposedNotification': identifier not found (..\src\serialport_win.cpp) [d:\projects\serialport-nw-tester\node_modules\se rialport\build\serialport.vcxproj]
..\src\win\enumser.cpp(443): warning C4996: 'GetVersionExA': was declared deprecated [d:\projects\serialport-nw-tester\node_modules\serialport\build\serialport.vcxproj]
          C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433) : see declaration of 'GetVersionExA'
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (c:\Users\Michael\AppData\Roaming\npm\node_modules\nw-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "c:\\Users\\Michael\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\bin\\nw-gyp.js" "build" "--runtime=node-webkit" "--target=0.11.2" "--msvs_version=2013" "--module=d:\\projects\\serialport-nw-tester\\node_modules\\serialport\\build\\serialport\\v1.5.0\\Release\\node-webkit-v0.11.2-win32-x64\\serialport.node" "--module_name=serialport" "--module_path=d:\\projects\\serialport-nw-tester\\node_modules\\serialport\\build\\serialport\\v1.5.0\\Release\\node-webkit-v0.11.2-win32-x64"
gyp ERR! cwd d:\projects\serialport-nw-tester\node_modules\serialport
gyp ERR! node -v v0.12.0
gyp ERR! nw-gyp -v v0.12.4
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'nw-gyp.cmd build --runtime=node-webkit --target=0.11.2 --msvs_version=2013 --module=d:\projects\serialport-nw-tester\node_modules\serialport\build\serialport\v1.5.0\Release\node-webkit-v0.11.2-win32-x64\serialport.node --module_name=serialport --module_path=d:\projects\serialport-nw-tester\node_modules\serialport\build\serialport\v1.5.0\Release\node-webkit-v0.11.2-win32-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (c:\Users\Michael\AppData\Roaming\npm\node_modules\node-pre-gyp\lib\util\compile.js:73:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:1008:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
node-pre-gyp ERR! System Windows_NT 6.3.9600
node-pre-gyp ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Users\\Michael\\AppData\\Roaming\\npm\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "rebuild" "--runtime=node-webkit" "--target=0.11.2" "--msvs_version=2013" node-pre-gyp ERR! cwd d:\projects\serialport-nw-tester\node_modules\serialport
node-pre-gyp ERR! node -v v0.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.4
node-pre-gyp ERR! not ok
Failed to execute 'nw-gyp.cmd build --runtime=node-webkit --target=0.11.2 --msvs_version=2013 --module=d:\projects\serialport-nw-tester\node_modules\serialport\build\serialport\v1.5.0\Release\node-webkit-v0.11.2-win32-x64\serialport.node --module_name=serialport --module_path=d:\projects\serialport-nw-tester\node_modules\serialport\build\serialport\v1.5.0\Release\node-webkit-v0.11.2-win32-x64' (1)

@Mithgol
Copy link

Mithgol commented Feb 19, 2015

@mike1808 serialport 1.5.0 uses nan 1.6.2, and nan (since version 1.6) requires a newer nw.js version (see nodejs/nan#238).

Try nw.js version 0.12.0-alpha3.

@Deliaz
Copy link

Deliaz commented Feb 22, 2015

konsumer, thanx for the #374 (comment)
The only advice that helped me

@jacobrosenthal
Copy link
Contributor

Huge thanks to everyone above for ironing out this process for me!

I did this today and wanted to update @konsumer's wonderful wrap up #374 (comment)

with the changes needed from #374 (comment)

Grab @konsumer's code, put into a directory nwktest, cd to that directory

First nobody mentioned installing these globally but they're being referenced that way, so I wanted to:

npm i -g node-pre-gyp
npm i -g nw-gyp

Then as stated:

npm install

Next go to the serialport source directory and rebuild there with the 12.0 alpha target

cd node_modules/serialport
node-pre-gyp rebuild --runtime=node-webkit --target=0.12.0-alpha3

Note I didnt have to move things around anymore. Then download and unpack the nwjs executable and run it against the nwktest directory

/Users/jacobrosenthal/Downloads/nwjs-v0.12.0-alpha3-osx-x64/nwjs.app/Contents/MacOS/nwjs ~/Desktop/nwktest

@mn1aC
Copy link

mn1aC commented Mar 22, 2015

On windows (32bits)

npm install serialport
cd /node_modules/serialport
node-pre-gyp rebuild --runtime=node-webkit --target=0.12.0 --target_arch=ia32

I get the following error:
node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd clean' (Error: sp awn node-gyp.cmd ENOENT) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\node-pre-gyp\lib\util\compile.js:67:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:107:17) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_proces s.js:1065:12) node-pre-gyp ERR! stack at child_process.js:1137:20 node-pre-gyp ERR! stack at process._tickCallback (node.js:355:11) node-pre-gyp ERR! System Windows_NT 6.1.7601 node-pre-gyp ERR! command "node" "C:\\Users\\User\\AppData\\Roaming\ \npm\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "rebuild" "--runtime=node-w ebkit" "--target=0.12.0" "--arch=ia32" node-pre-gyp ERR! cwd C:\Users\User\Desktop\nw\nw\nw\node_modules\se rialport node-pre-gyp ERR! node -v v0.12.0 node-pre-gyp ERR! node-pre-gyp -v v0.6.4 node-pre-gyp ERR! not ok Failed to execute 'node-gyp.cmd clean' (Error: spawn node-gyp.cmd ENOENT)

@tsangpozheng
Copy link

On Windows 7 64bits

CMD:
node_modules\serialport>node-pre-gyp rebuild --runtime=node-webkit --target=0.12.0 --target_arch=ia32

OUTPUT:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.4
node-pre-gyp info using node@0.10.35 | win32 | x64
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd clean' (Error: sp
awn ENOENT)
node-pre-gyp ERR! stack at ChildProcess. (C:\Users\Administrator
AppData\Roaming\npm\node_modules\node-pre-gyp\lib\util\compile.js:67:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:95:17)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_proces
s.js:818:12)
node-pre-gyp ERR! System Windows_NT 6.1.7601
node-pre-gyp ERR! command "node" "C:\Users\Administrator\AppData\Roaming\np
m\node_modules\node-pre-gyp\bin\node-pre-gyp" "rebuild" "--runtime=node-webk
it" "--target=0.12.0" "--target_arch=ia32"
node-pre-gyp ERR! cwd D:\workspace\shangweiji\node_modules\serialport
node-pre-gyp ERR! node -v v0.10.35
node-pre-gyp ERR! node-pre-gyp -v v0.6.4
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd clean' (Error: spawn ENOENT)

@camposcristian
Copy link

Instead of the rebuild command, i've used:

node-pre-gyp clean
nw-gyp configure --target=0.12.0-alpha3
node-pre-gyp build --runtime=node-webkit --target=0.12.0-alpha3

I think now building correctly, but if I execute the app now I've got an error on js console saying:

Uncaught Error: Cannot find module 'serialport'

@konsumer
Copy link

Try doing the rename step (mv) as in my above comment for that version. If the build is succeeding, but it's not able to find it, you can see the full path that it's looking for in the error.

On mac/linux it will be like this:

mv node_modules/serialport/build/serialport/WHATEVER/Release/node-webkit-WHATEVER WHATEVER-ITS-LOOKING-FOR

@PeteSteu
Copy link

PeteSteu commented May 6, 2015

My way to get it running on windows 7 64bit with node 0.12.2 and node-webkit 0.12.0

  • Install MS Visual Studio Express 2013 for Desktop
  • Install Python 2.7.6
  • Add Python to the path
  • Reboot
  • Open the 'Visual Studio Command Prompt' (Developer Eingabeaufforderung für VS2013)
  • Install nw-gyp with this command: npm install nw-gyp -g
  • Install node-pre-gyp with this command: npm install node-pre-gyp -g
  • Change to my working directory (project directory)
  • Install serialport with this command: npm install serialport
  • Switch to the serialport modul directory: cd node_modules\serialport
  • Make a clean: node-pre-gyp clean
  • Configure the build process: node-pre-gyp configure --runtime=node-webkit --target=0.12.0
  • Build the module for node-webkit: node-pre-gyp build --runtime=node-webkit --target=0.12.0
  • After all I have to change the directoryname from /node_modules/serialport/build/serialport/v1.6.3/Release/node-webkit-v0.12.0-win32-x64\ to
    /node_modules/serialport/build/serialport/v1.6.3/Release/node-webkit-v43-win32-x64\

That's it and it worked perfectly for me.

@voodootikigod
Copy link
Collaborator

This is due to the way nw.js/node-webkit changes the Node-ABI. This is not an issue with serialport, review this for more information: https://github.com/nwjs/nw.js/wiki/Using-Node-modules#3rd-party-modules-with-cc-addons

Closing

@dennisdevulder
Copy link

Sorry to rip open old wounds but after cracking my head over this for a while I found a fix for myself.

cd your_node_webkit_project_path (the one that includes the package.json)
npm install serialport
npm install node-pre-gyp -g
cd node_modules/serialport
node-pre-gyp rebuild --runtime=node-webkit --target=0.12.0

And it works.

@xypaul
Copy link

xypaul commented Oct 9, 2015

@dennisdevulder thanks so much this one helped me out soooo much :)

@hugocruz
Copy link

hugocruz commented May 5, 2016

@dennisdevulder Thanks, it worked for me. I needed also npm install -g nw-gyp.

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests