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

Already on GitHub? Sign in to your account

Problems using node-serialport in app.js. #147

Closed
bharrell opened this Issue Mar 28, 2013 · 6 comments

Comments

Projects
None yet
2 participants

The appjs windows distributable works fine for me.
Then I do "npm install serialport".
No errors, so far so good, serialport was added to my node_modules folder.
Next I add var serialport = require("serialport"); to the top of app.js
Now when i run app.js, i crash with the error below.
(i have a normal node app which uses serialport just fine, so i assume it's got something to do with the version of node.exe included in app.js? Has anyone else successfully used node-serialport with app.js? I tried using node 0.10.1 exe with a fix to the appjs bindings to allow versions higher than 0.8, but then i get assert errors. I'm on win7 x64, with 32bit node installed.)

C:\Users\bharrell\Desktop\testappjs\app\data>.\bin\node.exe --harmony app.js

C:\Users\bharrell\Desktop\testappjs\app\data\node_modules\serialport\node_modules\bindings\bindings.js:83
throw e
^
Error: The specified procedure could not be found.
C:\Users\bharrell\Desktop\testappjs\app\data\node_modules\serialport\build\Release\serialport.node
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at bindings (C:\Users\bharrell\Desktop\testappjs\app\data\node_modules\serialport\node_modules\bindings\bindings.js:76:44)
at Object. (C:\Users\bharrell\Desktop\testappjs\app\data\node_modules\serialport\serialport.js:7:44)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)

bharrell commented Apr 3, 2013

It was pointed out to me elsewhere that node.js is up to 0.10.x, but the windows app.js distributable uses node 0.8.x. Someone on the appjs github page said they had it working using an older version of serialport (1.0.8), but i'm having some issues building that version. Now i'm not sure if i should be trying to build the old version of serialport(details below), or trying to get the latest version to work somehow (see original post). If anyone has any suggestions, i'm running out of ideas. Thanks!

"npm install serialport" Works for me(and with node.js, though still won't work with appjs), but "npm install serialport@1.0.8" gives:

C:\Users\bharrell\Desktop\New folder\srlprt>npm install serialport@1.0.8
npm http GET https://registry.npmjs.org/serialport/1.0.8
npm http 304 https://registry.npmjs.org/serialport/1.0.8
npm http GET https://registry.npmjs.org/bindings/0.3.0
npm http GET https://registry.npmjs.org/async/0.1.18
npm http GET https://registry.npmjs.org/sf/0.1.3
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/node-gyp/0.6.2
npm http 304 https://registry.npmjs.org/async/0.1.18
npm http 304 https://registry.npmjs.org/sf/0.1.3
npm http 304 https://registry.npmjs.org/bindings/0.3.0
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/node-gyp/0.6.2
npm http GET https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/osenv
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/npmlog
npm http GET https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/tar
npm http GET https://registry.npmjs.org/which
npm http GET https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/osenv
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/fstream
npm http 304 https://registry.npmjs.org/npmlog
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/semver
npm http 304 https://registry.npmjs.org/tar
npm http 304 https://registry.npmjs.org/which
npm http 304 https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/ansi
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/block-stream
npm http 304 https://registry.npmjs.org/ansi
npm http 304 https://registry.npmjs.org/abbrev
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/block-stream

serialport@1.0.8 install C:\Users\bharrell\Desktop\New folder\srlprt\node_modules\serialport
node-gyp rebuild

C:\Users\bharrell\Desktop\New folder\srlprt\node_modules\serialport>node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild
serialport_unix.cpp
serialport_win.cpp
serialport.cpp
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc [C:\Users\bharrell\Desktop\New folder\srlprt\node_modules\serialp
ort\build\serialport.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc [C:\Users\bharrell\Desktop\New folder\srlprt\node_modules\serialp
ort\build\serialport.vcxproj]
..\src\serialport.cpp(51): error C2664: 'uv_queue_work' : cannot convert parame
ter 4 from 'void (__cdecl *)(uv_work_t *)' to 'uv_after_work_cb' [C:\Users\bhar
rell\Desktop\New folder\srlprt\node_modules\serialport\build\serialport.vcxproj
]
None of the functions with this name in scope match the target type
..\src\serialport.cpp(118): error C2664: 'uv_queue_work' : cannot convert param
eter 4 from 'void (__cdecl *)(uv_work_t *)' to 'uv_after_work_cb' [C:\Users\bha
rrell\Desktop\New folder\srlprt\node_modules\serialport\build\serialport.vcxpro
j]
None of the functions with this name in scope match the target type
..\src\serialport.cpp(146): error C2664: 'uv_queue_work' : cannot convert param
eter 4 from 'void (__cdecl *)(uv_work_t *)' to 'uv_after_work_cb' [C:\Users\bha
rrell\Desktop\New folder\srlprt\node_modules\serialport\build\serialport.vcxpro
j]
None of the functions with this name in scope match the target type
..\src\serialport.cpp(178): error C2664: 'uv_queue_work' : cannot convert param
eter 4 from 'void (__cdecl *)(uv_work_t *)' to 'uv_after_work_cb' [C:\Users\bha
rrell\Desktop\New folder\srlprt\node_modules\serialport\build\serialport.vcxpro
j]
None of the functions with this name in scope match the target type
..\src\serialport.cpp(214): error C2664: 'uv_queue_work' : cannot convert param
eter 4 from 'void (__cdecl *)(uv_work_t *)' to 'uv_after_work_cb' [C:\Users\bha
rrell\Desktop\New folder\srlprt\node_modules\serialport\build\serialport.vcxpro
j]
None of the functions with this name in scope match the target type
..\src\serialport.cpp(271): error C2664: 'uv_queue_work' : cannot convert param
eter 4 from 'void (__cdecl *)(uv_work_t *)' to 'uv_after_work_cb' [C:\Users\bha
rrell\Desktop\New folder\srlprt\node_modules\serialport\build\serialport.vcxpro
j]
None of the functions with this name in scope match the target type
..\src\serialport_win.cpp(229): error C2664: 'uv_queue_work' : cannot convert p
arameter 4 from 'void (__cdecl *)(uv_work_t *)' to 'uv_after_work_cb' [C:\Users
\bharrell\Desktop\New folder\srlprt\node_modules\serialport\build\serialport.vc
xproj]
None of the functions with this name in scope match the target type
gyp ERR! build error
gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:256:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:754:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\bharrell\Desktop\New folder\srlprt\node_modules\serialport
gyp ERR! node -v v0.10.1
gyp ERR! node-gyp -v v0.8.5
gyp ERR! not ok
npm ERR! serialport@1.0.8 install: node-gyp rebuild
npm ERR! cmd "/c" "node-gyp rebuild" failed with 1
npm ERR!
npm ERR! Failed at the serialport@1.0.8 install script.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "serialport@1.0.8"
npm ERR! cwd C:\Users\bharrell\Desktop\New folder\srlprt
npm ERR! node -v v0.10.1
npm ERR! npm -v 1.2.15
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\bharrell\Desktop\New folder\srlprt\npm-debug.log
npm ERR! not ok code 0

C:\Users\bharrell\Desktop\New folder\srlprt>

Collaborator

adrai commented Apr 3, 2013

Can you create a temporary sample repository so we can try...?
https://github.com/bharrell/appjs-and-serialport or something like that...

bharrell commented Apr 3, 2013

Sure! Here you go https://github.com/bharrell/appjs-and-serialport
In case you don't want to take binaries from strangers, but want to reproduce, all i've done here is:


1-downloaded the windows distributable of appjs,
2-went into app/data/ and did "npm install serialport --arch=ia32". No errors.
3-added var serialport = require("serialport"); to the top of app.js


Without the require in appjs, the hello world window pops up when i run app.exe.
With the require("serialport"), i get:


C:\Users\bharrell\Documents\GIT\appjs-and-serialport\app\data>.\bin\node.exe --harmony .\app.js

C:\Users\bharrell\Documents\GIT\appjs-and-serialport\app\data\node_modules\serialport\node_modules\bindings\bindings.js:83
throw e
^
Error: The specified procedure could not be found.
C:\Users\bharrell\Documents\GIT\appjs-and-serialport\app\data\node_modules\serialport\build\Release\serialport.node
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at bindings (C:\Users\bharrell\Documents\GIT\appjs-and-serialport\app\data\node_modules\serialport\node_modules\bindings\bindings.js:76:44)
at Object. (C:\Users\bharrell\Documents\GIT\appjs-and-serialport\app\data\node_modules\serialport\serialport.js:7:44)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)


Since this wasn't working, i tried "npm install serialport@1.0.8", since someone else had appjs working with this version, but i get the compile issues i mentioned in my previous post. I found a commit that mentioned this, or a very similar compile error being fixed for nodejs 0.10.x voodootikigod#143

bharrell commented Apr 3, 2013

i got serialport 1.0.8 x32 to compile on another machine. Must've been something screwy with my environment, but even with that i'm getting the "procedure could not be found" crash as soon as i do var serialport = require("serialport");

Collaborator

adrai commented Apr 3, 2013

I went to app\data\node_modules\serialport and executed npm install.
With installed node 0.8.22 it works!
It should working with node 0.10.x too when appjs releases new version including (https://github.com/appjs/appjs/issues/328)

bharrell commented Apr 3, 2013

Hurray! We just got it working on another machine which had 0.8.21 installed by using the installed node.exe instead of the one packaged with appjs, which i think is 0.8.something. I have no idea what's wrong with the included node.exe but using the one from http://nodejs.org/dist/v0.8.21/node.exe , and node-serialport 1.0.8 for x32 (haven't tried latest yet), it worked like a charm.

Thank you all so much for the help! I'll close the issue.

I was also posting on the appjs github page, so i'll link the two together for future reference: https://github.com/appjs/appjs/issues/336

@bharrell bharrell closed this Apr 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment