pokusew / nfc-pcsc

Easy reading and writing NFC tags and cards in Node.js
MIT License
533 stars 132 forks source link

was compiled against a different Node.js version using NODE_MODULE_VERSION 111. This version of Node.js requires NODE_MODULE_VERSION 110. #138

Open odysahe opened 1 year ago

odysahe commented 1 year ago

Hello, sorry I'm still a newbie, I created a nuxtjs and electron desktop application project for attendance list. My nfc reader uses ACR122. After i installed nfc-pcsc i got the following error:

A JavaScript error occurred in the main process 
Uncaught Exception:
Error: The module '/absdesk/node_modules/@pokusew/pcsclite/build/Release/pcsclite.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 111. This version of Node.js requires
NODE_MODULE_VERSION 110. Please try re-compiling or re-installing

I have changed node version, after browsing to node.js release website i am not getting NODE_MODULE_VERSION 110.

Screenshot from 2023-01-13 17-18-57

I've also tried the solution from pokusew/node-pcsclite issues but it still doesn't work. can someone help me?

node.js v19.4.0 nfc-pcsc : ^0.8.1 nuxt : ^2.15.8 electron : ^22.0.0 electron-builder : ^23.6.0 electron-devtools-installer : ^3.2.0

davidgs commented 1 year ago

Solution:

yarn add -D @electron/rebuild

Then add the following to your package.json:

"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",

You can then run yarn run rebuild and it will rebuild with the right node version.

mattlebel commented 1 year ago

I was running into this error:

App threw an error during load
Error: The module '/Users/USER_VAR/electron-quick-start/node_modules/@pokusew/pcsclite/build/Release/pcsclite.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 108. This version of Node.js requires
NODE_MODULE_VERSION 116. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1822)
    at Module._extensions..node (node:internal/modules/cjs/loader:1354:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:2:1822)
    at Module.load (node:internal/modules/cjs/loader:1124:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at f._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1148:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at bindings (/Users/USER_VAR/electron-quick-start/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/Users/USER_VAR/electron-quick-start/node_modules/@pokusew/pcsclite/lib/pcsclite.js:4:37)
[60615:0531/124805.752891:ERROR:CONSOLE(1)] "Uncaught (in promise) TypeError: Failed to fetch", source: devtools://devtools/bundled/panels/elements/elements.js (1)

I solved it by:

  1. Updating my init scripts in package.json to:
  "scripts": {
    "start": "electron .",
    "ebuild": "electron-rebuild",
    "build-workspace": "npm install && npm run ebuild"
  },
  1. Installing electron/rebuild via

npm install --save-dev @electron/rebuild

  1. Running npm run build-workspace
alessandroraffa commented 8 months ago

This is my issue:

Error: The module '/projectRoot/node_modules/@pokusew/pcsclite/build/Release/pcsclite.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 115. This version of Node.js requires
NODE_MODULE_VERSION 121. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (node:electron/js2c/node_init:2:2214)
    at Module._extensions..node (node:internal/modules/cjs/loader:1343:18)
    at Object.func [as .node] (node:electron/js2c/node_init:2:2214)
    at Module.load (node:internal/modules/cjs/loader:1098:32)
    at Module._load (node:internal/modules/cjs/loader:945:12)
    at c._load (node:electron/js2c/node_init:2:13672)
    at Module.require (node:internal/modules/cjs/loader:1122:19)
    at require (node:internal/modules/helpers:130:18)
    at bindings (/projectRoot/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/projectRoot/node_modules/@pokusew/pcsclite/lib/pcsclite.js:4:37)

I've added and run the rebuild script (also cleaning the project):

"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",

But the issue persists.

Below my environment:

macOS: Ventura 13.3.1 nvm: 0.38.0 node: v20.11.0 npm: 10.2.4 yarn: 4.1.0

electron: 29.1.0 nfc-pcsc: 0.8.1 @electron/rebuild: 3.6.0 electron-builder: 24.13.3 electron-devtools-installer: 3.2.0 electron-icon-maker: 0.0.5 electron-reload: 2.0.0-alpha.1