Open philoliver opened 7 years ago
I did some research and found out that the TypeError: exists is not a function
appears to be a bug in the node-bindings
module. See: https://github.com/TooTallNate/node-bindings/pull/20
It should be fixed when the new release is available on NPM.
However, going one step further, this fix will still not make the it work when using AngularCLI/Webpack. To make it work in this scenario we would need to usenode-loader
instead of node-bindings
to load the binding file.
I did the following change to make it work locally:
"dependencies": {
"bindings": "github:tootallnate/node-bindings#pull/20/head", < Instead of this,
"node-loader": "^0.6.0", << use this
"nan": "^2.5.1"
},
Then edited "/node_modules/@pokusew/pcsclite/lib/pcsclite.js"
const pcsclite = require('node-loader!./../build/Release/pcsclite.node');
Hi @philoliver
Thank you for posting your problem.
I am quite busy now, but I'll look at it today or tomorrow.
Hi @philoliver @pokusew Just to let you know that I have had exactly the same error and this fixed it also. Currently using a gulp task to search + replace the code post install. Thanks @philoliver for finding the fix! Cheers
Updating the node-binding to 1.3.0 does not seem to have solved the issue as @philoliver pointed out. Is there a permanent solution to this problem instead of using gulp because i am a noob and am not familiar with it. Thanks for the awesome lib by the was. If not for this I would not be able to make my code platform independent. I am using an Electron app with angular 4 to read and write data in nfc tags.
Hi @dhruv217,
I think it should work. Check out Can I use this library in my angular-electron app? in FAQ section of the README. In the linked https://github.com/pokusew/nfc-pcsc/issues/24#issuecomment-327038188, there is described what needs to be done in order to make it work.
It is related to the angular-electron boilerplate, but I think, that's what you are using in your project https://github.com/dhruv217/shrabik-smart-card-reader.
Please let me know, if it works for you. If you encounter any problems feel free to contact me. 🙂 I am available for chat here https://discord.gg/bg3yazg.
Hope it helps. 🙂
PS Don't forget to star ⭐️ my library, if you find it useful. 😃 Thanks.
@philoliver thanks for your contribution. After making your changes proposed above i've got this error
Uncaught Error: Cannot open /***/node_modules/@pokusew/pcsclite/build/Release/pcsclite.node:
TypeError: Cannot read property 'dlopen' of undefined
at Object.<anonymous> (pcsclite.node:1)
at Object../node_modules/node-loader/index.js!./node_modules/@pokusew/pcsclite/build/Release/pcsclite.node (vendor.js:72750)
at __webpack_require__ (bootstrap:78)
at Object.<anonymous> (pcsclite.js:4)
at Object../node_modules/@pokusew/pcsclite/lib/pcsclite.js (pcsclite.js:197)
at __webpack_require__ (bootstrap:78)
at Object../node_modules/nfc-pcsc/dist/NFC.js (NFC.js:8)
at __webpack_require__ (bootstrap:78)
at Object../node_modules/nfc-pcsc/dist/index.js (index.js:145)
at __webpack_require__ (bootstrap:78)
i'm frozen here, dont know how to continue. i'm using Angular 7.2 and electron 5.0.1
any idea?
I facing the similar issue ,any update on this issue ??
+1 👍
Any updates?
+1 I try philoliver solution and got
Uncaught Error: node-loader: TypeError: process.dlopen is not a function
+1 I tried philoliver's solution as well and got:
./node_modules/@pokusew/pcsclite/build/Release/pcsclite.node (./node_modules/node-loader/dist/cjs.js!./node_modules/@pokusew/pcsclite/build/Release/pcsclite.node)
TypeError: this.getOptions is not a function
Hi, I have an Angular CLI project running in Electron. When I follow your instructions and import the module like this
import NFC from '../../../node_modules/nfc-pcsc';
, and callconst nfc = new NFC(minilogger);
, then I get the following error in the console:And during the build process