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

creates a not loadable module for node-serialport #7

Closed
davibe opened this issue Apr 15, 2013 · 14 comments
Closed

creates a not loadable module for node-serialport #7

davibe opened this issue Apr 15, 2013 · 14 comments

Comments

@davibe
Copy link

davibe commented Apr 15, 2013

I am using nw-gyp on windows with configure --target=0.5.0 to build the module "node-serialport" and use it with node-webkit 0.5.0.

The procedure does work on my mac but since I also need to distribute the application on Windows i have to build it on windows too. My Windows XP virtual machine has Vistual Studio 2010 installed. The build works fine with no errors generating serialport.node but then node-webkit is unable to open serialbox.node to load the module.

Uncaught Error: The specified module could not be found.
C:\Documents and Settings\Administrator\Desktop\baseflight-configurator\win\baseflight-configurator\node_modules\serialport\build\Release\serialport.node

even if the file is there.

Building with standard node-gyp and loading it with standard node works fine so.. what to do ?

@rogerwang
Copy link
Member

Thanks for reporting. Could you please upload your binary somewhere so I can try it from here?

@davibe
Copy link
Author

davibe commented Apr 17, 2013

which binary ? serialport.node ?

I think it would be better if you try this on a windows machine

npm install nw-gyp
npm install serialport

then rebuild it with nw-gyp by hand

cd node_modules/serialport
nw-gyp clean
nw-gyp configure --target=0.5.0
nw-gyp build

and then try to load it from any node-webkit application using node-webkit 0.5.0

require('serialport');

you will see import error in the inspector (the same errors you would see requiring it directly from a normal node shell)

This procedure works as expected on macosx.

@davibe davibe closed this as completed Apr 17, 2013
@davibe davibe reopened this Apr 17, 2013
@davibe
Copy link
Author

davibe commented Apr 17, 2013

sorry, closed by accident

@owenc4a4
Copy link

On Windows7, it works well.

@owenc4a4
Copy link

Please check whether serialport.node exists. And if there are any error when running nw-gyp

@davibe
Copy link
Author

davibe commented Apr 18, 2013

let's see, I am using windows XP + visual studio 2010 (there is also vs2008 installed)

C:\Documents and Settings\Administrator>NODE -v
v0.10.3

C:\Documents and Settings\Administrator>NPM -v
1.2.17

C:\Documents and Settings\Administrator>nw-gyp -v
v0.7.3-4

C:\Documents and Settings\Administrator>npm install serialport
npm http GET https://registry.npmjs.org/serialport
npm http 304 https://registry.npmjs.org/serialport
npm http GET https://registry.npmjs.org/bindings/1.1.0
npm http GET https://registry.npmjs.org/async/0.1.18
npm http GET https://registry.npmjs.org/sf/0.1.6
npm http GET https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/bindings/1.1.0
npm http 304 https://registry.npmjs.org/sf/0.1.6
npm http 304 https://registry.npmjs.org/optimist
npm http 200 https://registry.npmjs.org/async/0.1.18
npm http GET https://registry.npmjs.org/async/-/async-0.1.18.tgz
npm http 200 https://registry.npmjs.org/async/-/async-0.1.18.tgz
npm http GET https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/wordwrap

> serialport@1.1.0 install C:\Documents and Settings\Administrator\node_modules\
serialport
> node-gyp rebuild


C:\Documents and Settings\Administrator\node_modules\serialport>node "C:\Program
 Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin
\node-gyp.js" rebuild
  serialport.cpp
  serialport_unix.cpp
  serialport_win.cpp
  enumser.cpp
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning
C4530: C++ exception handler used, but unwind semantics are not enabled. Specif
y /EHsc [C:\Documents and Settings\Administrator\node_modules\serialport\build\
serialport.vcxproj]
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning
C4530: C++ exception handler used, but unwind semantics are not enabled. Specif
y /EHsc [C:\Documents and Settings\Administrator\node_modules\serialport\build\
serialport.vcxproj]
C:\Documents and Settings\Administrator\.node-gyp\0.10.3\deps\v8\include\v8.h(1
84): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Pe
rsistent<T>::New(v8::Handle<T>)' [C:\Documents and Settings\Administrator\node_
modules\serialport\build\serialport.vcxproj]
          with
          [
              T=v8::Object
          ]
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning
C4530: C++ exception handler used, but unwind semantics are not enabled. Specif
y /EHsc [C:\Documents and Settings\Administrator\node_modules\serialport\build\
serialport.vcxproj]
C:\Documents and Settings\Administrator\.node-gyp\0.10.3\deps\v8\include\v8.h(1
84): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Pe
rsistent<T>::New(v8::Handle<T>)' [C:\Documents and Settings\Administrator\node_
modules\serialport\build\serialport.vcxproj]
          with
          [
              T=v8::Object
          ]
  disphelper.c
     Creating library C:\Documents and Settings\Administrator\node_modules\seri
  alport\build\Release\serialport.lib and object C:\Documents and Settings\Admi
  nistrator\node_modules\serialport\build\Release\serialport.exp
  Generating code
  Finished generating code
  serialport.vcxproj -> C:\Documents and Settings\Administrator\node_modules\se
  rialport\build\Release\\serialport.node
serialport@1.1.0 node_modules\serialport
├── bindings@1.1.0
├── async@0.1.18
├── sf@0.1.6
└── optimist@0.3.7 (wordwrap@0.0.2)

C:\Documents and Settings\Administrator>node
> require('serialport')
{ list: [Function],
  SerialPort:
   { [Function: SerialPort]
     super_:
      { [Function: Stream]
        super_: [Object],
        Readable: [Object],
        Writable: [Object],
        Duplex: [Object],
        Transform: [Object],
        PassThrough: [Object],
        Stream: [Circular] } },
  parsers: { raw: [Function], readline: [Function] } }
>

So far it works then

C:\Documents and Settings\Administrator>cd node_modules\serialport

C:\Documents and Settings\Administrator\node_modules\serialport>nw-gyp clean
gyp info it worked if it ends with ok
gyp info using nw-gyp@0.7.3-4
gyp info using node@0.10.3 | win32 | ia32
gyp info ok

C:\Documents and Settings\Administrator\node_modules\serialport>nw-gyp configure
 --target=0.5.0
gyp info it worked if it ends with ok
gyp info using nw-gyp@0.7.3-4
gyp info using node@0.10.3 | win32 | ia32
gyp info spawn python
gyp info spawn args [ 'C:\\Documents and Settings\\Administrator\\.nw-gyp\\0.5.0
\\tools\\gyp\\gyp',
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:\\Documents and Settings\\Administrator\\node_modules\\
serialport\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Documents and Settings\\Administrator\\Application Da
ta\\npm\\node_modules\\nw-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Documents and Settings\\Administrator\\.nw-gyp\\0.5.0
\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Documents and Settings\\Administrator
\\.nw-gyp\\0.5.0',
gyp info spawn args   '-Dmodule_root_dir=C:\\Documents and Settings\\Administrat
or\\node_modules\\serialport',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Documents and Settings\\Administrator\\node_modules\\
serialport\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok

C:\Documents and Settings\Administrator\node_modules\serialport>nw-gyp build
gyp info it worked if it ends with ok
gyp info using nw-gyp@0.7.3-4
gyp info using node@0.10.3 | win32 | ia32
gyp info spawn C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\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=Win32' ]
  serialport.cpp
  serialport_unix.cpp
  serialport_win.cpp
  enumser.cpp
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning
C4530: C++ exception handler used, but unwind semantics are not enabled. Specif
y /EHsc [C:\Documents and Settings\Administrator\node_modules\serialport\build\
serialport.vcxproj]
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning
C4530: C++ exception handler used, but unwind semantics are not enabled. Specif
y /EHsc [C:\Documents and Settings\Administrator\node_modules\serialport\build\
serialport.vcxproj]
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning
C4530: C++ exception handler used, but unwind semantics are not enabled. Specif
y /EHsc [C:\Documents and Settings\Administrator\node_modules\serialport\build\
serialport.vcxproj]
  disphelper.c
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(991,5):
warning MSB8012: TargetExt(.dll) does not match the Linker's OutputFile propert
y value (.node). This may cause your project to build incorrectly. To correct t
his, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property v
alues match the value specified in %(Link.OutputFile). [C:\Documents and Settin
gs\Administrator\node_modules\serialport\build\serialport.vcxproj]
     Creating library C:\Documents and Settings\Administrator\node_modules\seri
  alport\build\Release\serialport.lib and object C:\Documents and Settings\Admi
  nistrator\node_modules\serialport\build\Release\serialport.exp
  Generating code
  Finished generating code
  serialport.vcxproj -> C:\Documents and Settings\Administrator\node_modules\se
  rialport\build\Release\\serialport.node
gyp info ok

C:\Documents and Settings\Administrator\node_modules\serialport>cd ..\..

C:\Documents and Settings\Administrator>node
> require('serialport')
Error: The specified module could not be found.
C:\Documents and Settings\Administrator\node_modules\serialport\build\Release\se
rialport.node
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at bindings (C:\Documents and Settings\Administrator\node_modules\serialport
\node_modules\bindings\bindings.js:76:44)
    at Object.<anonymous> (C:\Documents and Settings\Administrator\node_modules\
serialport\serialport.js:7:44)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
>

C:\Documents and Settings\Administrator>dir node_modules\serialport\build\Releas
e\serialport.node
 Volume in drive C has no label.
 Volume Serial Number is 5CE1-1721

 Directory of C:\Documents and Settings\Administrator\node_modules\serialport\bu
ild\Release

04/18/2013  09:23 AM           121,856 serialport.node
               1 File(s)        121,856 bytes
               0 Dir(s)  12,812,058,624 bytes free

As you can see the file exists. It is not loaded by the standard node which
could make sense because it's built for node-webkit (does it?) but even loading
it using node-webkit gives the following error

Uncaught Error: The specified module could not be found.
C:\Documents and Settings\Administrator\Desktop\baseflight-configurator\win\baseflight-configurator\node_modules\serialport\build\Debug\serialport.node C:\Documents and Settings\Administrator\Desktop\baseflight-configurator\win\baseflight-configurator…:85

But the file is there

C:\Documents and Settings\Administrator\Desktop\baseflight-configurator\win\base
flight-configurator>dir "C:\Documents and Settings\Administrator\Desktop\basefli
ght-configurator\win\baseflight-configurator\node_modules\serialport\build\Debug
\serialport.node"
 Volume in drive C has no label.
 Volume Serial Number is 5CE1-1721

 Directory of C:\Documents and Settings\Administrator\Desktop\baseflight-configu
rator\win\baseflight-configurator\node_modules\serialport\build\Debug

04/15/2013  07:06 AM           121,856 serialport.node
               1 File(s)        121,856 bytes
               0 Dir(s)  12,810,264,576 bytes free

Sorry I have been verbose but it might be useful. What could I try ?

@davibe
Copy link
Author

davibe commented Apr 18, 2013

This is my built serialport.node
I can't attach it here so I give you the link https://dl.dropboxusercontent.com/u/968175/serialport.node

@owenc4a4
Copy link

I use your file, it still works. This is my code: https://s3.amazonaws.com/node-webkit/owen-cloud/app.zip

1 similar comment
@owenc4a4
Copy link

I use your file, it still works. This is my code: https://s3.amazonaws.com/node-webkit/owen-cloud/app.zip

@davibe
Copy link
Author

davibe commented Apr 18, 2013

oh my..

I changed the name from nw.exe to myAppName.exe and if I do that it does not find the module anymore (even if the path where it says it's looking for is right). If i rename it back to nw.exe it works. Also it works if I copy the exe and have both myAppName.exe and nw.exe in the application folder.

So.. it's "solved". It's not a bug of nw-gyp it's just strange behaviour of nw. Sorry to have bothered you.

@davibe davibe closed this as completed Apr 18, 2013
@rogerwang
Copy link
Member

Yeah, it's this issue nwjs/nw.js#199 . It should be added to the document to remind the users.

@davibe
Copy link
Author

davibe commented May 7, 2013

Hi Roger.

I found another issue i am not sharing on github because it's very
specific. I have an nw-application that uses a flash plugin i wrote to send
webcam stream to a Wowza server. The plugin works fine but it seems to have
problems with focus when i click the left button mouse and go to
"Settings.." to set up flash player input source (webcam, microfphone). The
result is that the configuration dialog does not work at all i can't click
any where. It's like it does not receive clicks. However i can use the TAB
keyboard key to put focus on items and use enter to select them.

This 'focus problem' holy happens in node-webkit every other browser works
fine.

I tried to open youtube website from node-webkit to see if their flash
plugin had the same problems too. In this case the click events works but
not always. I can clearly see i have to click more than once to get items
to react.

I am using last version 0.5.1 on the most recent mascosx.

I am sending you a small zip with the application i'm talking about so you
can try it if you have time.

Thanks.

On Fri, Apr 19, 2013 at 12:14 AM, Roger Wang notifications@github.comwrote:

Yeah, it's this issue nwjs/nw.js#199nwjs/nw.js#199. It should be added to the document to remind the users.


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-16615046
.

@ice6
Copy link

ice6 commented Sep 23, 2014

@davibe I met this problem too.

@fifsky
Copy link

fifsky commented Oct 26, 2016

我的天啊,我在这个问题上卡了几个月,今天终于解决了,原来是不能重命名nw.exe文件名称,可是为什么呢,有没有办法可以替换 v0.12.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants