1

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?

Ponzio Pilato
  • 315
  • 1
  • 5
  • 18

2 Answers2

1

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

Malcolm Swaine
  • 1,929
  • 24
  • 14
0

Solved with this:

How do I resolve "Cannot find module" error using Node.js?

using npm install

and then

Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51

using

./node_modules/.bin/electron-rebuild

Ponzio Pilato
  • 315
  • 1
  • 5
  • 18