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

Error using 'fastcall' module. #646

Closed
T-Hacker opened this issue Jan 4, 2017 · 6 comments
Closed

Error using 'fastcall' module. #646

T-Hacker opened this issue Jan 4, 2017 · 6 comments

Comments

@T-Hacker
Copy link

T-Hacker commented Jan 4, 2017

Hi, I'm a C++ and Rust developer and I'm not accustomed to using so many tools and modules. You can say I'm a bit lost...

What I want to do is simple. I want to use fastcall module to invoke some native code. Here's what I've tried so far:

1- Added fastcall dependency to the root package.json file.
When I build the project, theses errors appear:

ERROR in ./~/fastcall/es5/benchmarks/importBenchlib.js
Module not found: Error: Cannot resolve module 'ffi' in /home/pedro/electron/test2/node_modules/fastcall/es5/benchmarks
 @ ./~/fastcall/es5/benchmarks/importBenchlib.js 24:10-24

ERROR in ./~/fastcall/es5/lib/es5Support.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../es5 in /home/pedro/electron/test2/node_modules/fastcall/es5/lib
 @ ./~/fastcall/es5/lib/es5Support.js 49:28-54

2- Added 'ffi' module to root package.json dependencies. Build project, the first error is solved, but the second still stands:

ERROR in ./~/fastcall/es5/lib/es5Support.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../es5 in /home/pedro/electron/test2/node_modules/fastcall/es5/lib
 @ ./~/fastcall/es5/lib/es5Support.js 49:28-54

3- At this point, I've reset the project and added the 'fastcall' dependency in the app/package.json. It builds fine, but when I run the application I get this error on console:

Uncaught Error: Module version mismatch. Expected 50, got 51.

I'm aware that the ABIs from electron and my 'node_modules' don't match, so I tried to recompile them with 'electron-rebuild', but still got the same error.

Is it possible to use 'fastcall' with electron-react-boilerplate? Thank you for your time.

@amilajack
Copy link
Member

@dustintownsend
Copy link
Collaborator

I'm not 100% sure, but you can try to set the ABI version to 50.
export npm_config_abi=50

@jhen0409
Copy link
Member

jhen0409 commented Jan 5, 2017

I remember electron-rebuild is only for node-gyp rebuild (binding.gyp), looks like fastcall is using cmake-js for build, so you may refer to cmake-js usage.

Change to: (install script in package.json of node_modules/fastcall)

    "install": "cmake-js compile --runtime=electron --runtime-version=1.4.13",

Then, remove build/ and re-run the script. (it worked for me)

@T-Hacker
Copy link
Author

T-Hacker commented Jan 5, 2017

It worked! Thank you very much!

(Didn't test @dustintownsend solution, but thanks anyway!)

@T-Hacker
Copy link
Author

T-Hacker commented Jan 7, 2017

I believe I found a better solution to my problem.

Adding this to app/package.json will solve all ABI problems with packages that rely on cmake-js to build themselves:

  "cmake-js": {
    "runtime": "electron",
    "runtimeVersion": "1.4.13"
  }

If only someone knew how to fill automatically the runtime version of electron...

@Suhail
Copy link

Suhail commented Jul 16, 2019

I still get this error:

digit@mighty-dev MINGW64 ~/Desktop/workspace (suhail/keyboard-shortcuts)
$ npm install -g cmake-js
C:\Users\digit\AppData\Roaming\npm\cmake-js -> C:\Users\digit\AppData\Roaming\npm\node_modules\cmake-js\bin\cmake-js
+ cmake-js@5.3.0
updated 1 package in 5.197s

digit@mighty-dev MINGW64 ~/Desktop/workspace (suhail/keyboard-shortcuts)
$ npm install fastcall                                                                                                                                                                                         

> fastcall@0.2.6 install C:\Users\digit\Desktop\workspace\node_modules\fastcall
> cmake-js compile

ERR! OMG There is no Visual C++ compiler installed. Install Visual C++ Build Toolset or Visual Studio.
ERR! OMG There is no Visual C++ compiler installed. Install Visual C++ Build Toolset or Visual Studio.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):

On Windows 10

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

No branches or pull requests

5 participants