I'm new on NodeJS/ElectronJS. I need to use User.dll functions. My actual situation is:

Windows 10 on Parallels Node -v = 10.15.3 (LTS) NPM -v = 6.9.0

I installed:

npm install --global --production windows-build-tools

npm install win32-api

npm install ffi (gives me several "\ffi.cc(***): warning C4996: 'v8::Value::To Object': .... deprecated)

I added var FFI = require('node-ffi'); in my "main.js" and when I try to compile with npm start

I obtain this error:

Error: Cannot find module 'node-ffi' at Module._resolveFilename (internal/modules/cjs/loader.js:584:15)

What's wrong?

2 Answers

0
Ponzio Pilato On
1
Malcolm Swaine On

The following steps fixed my issue (major pain in the ***)

Make sure the node gyp compiler is installed

npm install -g node-gyp

Install the FFI package into the local project

npm install --save ffi

I also needed to install ref-array (part of example code)

npm install ref-array --save

Go into the node_modules/ffi directory and do an NPM install to make sure it's got all it's dependencies

cd node_modules/ffi
npm install

Get back out of the node_modules/ffi folder

cd ../../

Install the electron rebuild tools

npm install --save-dev electron-rebuild

Run the electron rebuild script (I'm running on Windows, hence .cmd)

.\node_modules\.bin\electron-rebuild.cmd

So simple (NOT) :D