Git Product home page Git Product logo

Comments (10)

RichardFoss avatar RichardFoss commented on August 27, 2024

To be more explicit with the error message, it is:
Uncaught error: A dynamic link library (DLL) initialization routine failed module.js :640

from cap.

RichardFoss avatar RichardFoss commented on August 27, 2024

Sorry, didn't mean to close this!!

from cap.

mscdex avatar mscdex commented on August 27, 2024

Sorry, I don't really have any experience with compiling addons for use with nw.js.

from cap.

RichardFoss avatar RichardFoss commented on August 27, 2024

Thanks for the quick reply - I will see if I can initialize cap under Windows just from node.js. I didn't think that nw.js would be the problem. I used nw.js with cap on the Mac and it worked fine.

from cap.

mscdex avatar mscdex commented on August 27, 2024

IIRC nw.js has its own special method of compiling addons (using nw-gyp) in order to properly integrate with its bundled chrome/chromium (V8 really).

Using cap directly with node on Windows should definitely work fine though.

from cap.

RichardFoss avatar RichardFoss commented on August 27, 2024

This all makes sense. I will try node and cap tomorrow. Thanks for the help!

from cap.

RichardFoss avatar RichardFoss commented on August 27, 2024

Using cap directly with node on Windows does indeed take me beyond the 'require' statement where my error occurred. I do need the nw capabilities, and have posted the following on the nw.js site:

I have been successfully using the module cap in an osx node/nw program to receive and transmit Ethernet packets. I am porting the program to Windows, and have an issue with the cap module.

I am using node.js v6.11.0 and nw.js v0.23.5. Windows 8.1.

A problem arises at the statement:
var Cap = require('cap').Cap;
Where I get the following output:

module.js:640 Uncaught Error: A dynamic link library (DLL) initialization routine failed.
\?\D:\AVBFlexSDK\node_modules\cap\build\Release\cap.node
at Object.Module._extensions..node (module.js:640:18)
at Module.load (module.js:527:32)
at tryModuleLoad (module.js:490:12)
at Function.Module._load (module.js:482:3)
at Module.require (module.js:537:17)
at require (internal/module.js:11:18)
at Object. (D:\AVBFlexSDK\node_modules\cap\lib\Cap.js:3:13)
at Module._compile (module.js:593:30)
at Object.Module._extensions..js (module.js:610:10)
at Module.load (module.js:527:32)

The statement is not a problem within a node.js program, and the cap module installs fine (Python 2.7 and Visual C++ installed). I have done the following to resolve the issue:

  1. Given that I am using an LTS release, I first replaced the win_delay_load_hook.cc file with the one given on the nw.js documentation page. The require statement resulted in the same error message.
  2. I then followed the procedure for the non-LTS releases:
    set PYTHON=C:\Python27\python.exe
    set npm_config_target=0.23.5
    set npm_config_arch=x64
    set npm_config_runtime=node-webkit
    set npm_config_build_from_source=true
    set npm_config_node_gyp=C:\Users<my info>\AppData\Roaming\npm\node_modules
    Still the same result - an error at the require statement.

Possibly someone in this group has had a similar experience and resolved it - which would be wonderful!

from cap.

robsontenorio avatar robsontenorio commented on August 27, 2024

@RichardFoss Its just about "prebuild" the target package "cap" (https://www.npmjs.com/package/prebuild).
I use Electron, so "prebuild" provide a way to compile the package to the target OS/arch. You need to find some similar tool on NW.JS.

So, that issue has nothing to do with "cap", but the way packages are compiled to the target OS.

from cap.

RichardFoss avatar RichardFoss commented on August 27, 2024

Thanks robsontenorio! I managed to resolve my issue and have meant to post my solution to the group in case anyone else has a similar dilemma. The steps I took are given below. Step d is the "similar tool" that you are referring to.

For native node modules (for example cap), you will:
a. First need to install all the required tools and configurations. To do this, you could use Microsoft's windows-build-tools using:
npm install --global --production windows-build-tools
from an elevated PowerShell or CMD.exe (run as Administrator). This will install Visual Studio and also Python 2.7.
b. On Windows, you need to replace the file
\node_modules\node-gyp\src\win_delay_load_hook.cc
with the one at
https://github.com/nwjs/nw.js/blob/nw18/tools/win_delay_load_hook.cc
before installing modules with node-gyp or npm.
c. Run the following command in your terminal to install nw-gyp globally:
npm install -g nw-gyp
d. If for example, cap is the native module, then in the node_modules/cap folder, run
nw-gyp rebuild --target=0.23.5(or whatever your version of nw.js is)
e. In your native module documentation, look for any programming guidelines that are unique to Windows. For example in cap:
setMinBytes(< integer >nBytes) - (void) - (Windows ONLY) This sets the minimum number of packet bytes that must be captured before the full packet data is made available.

from cap.

mscdex avatar mscdex commented on August 27, 2024

Thanks for the information @robsontenorio and @RichardFoss

from cap.

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.