Comments (3)
Hi @Khasanboy,
I addressed the problem. It is caused by Babel export default
transform behaviour (see http://stackoverflow.com/a/33705077).
If you use Babel transpiler (with ES6 modules support) for you app code too, you can import it like import NFC from 'nfc-pcsc'
.
Otherwise you must use const NFC = require('nfc-pcsc').default
. (add .default
).
I know, that's not very intuitive.
Thank you very much for drawing my attention to this problem. I'll prepare a solution (maybe using babel-plugin-add-module-exports and add info to docs.
To this problem:
I am trying to create application using Electron. In the beginning I was getting problem with node Module versions that was expecting 51 but required 53. I installed Electron 1.5.1 and that error is fixed...
Node Native modules must be built with the correct version of Node.js, in which they will be used.
So, if you install this library with npm, it is built with your machine's Node.js version. But then, you are using the library in Electron and Electron uses its own version of Node.js internally.
So after installing a library with Node Native Module, you must rebuild the source with correct Electron headers.
(for example you can run this node-gyp command: cd node_modules/nfc-pcsc && node-gyp rebuild --target=[electronVersion] --arch=[arch] --dist-url=https://atom.io/download/atom-shell
)
The usage with Electron is described in README FAQs section Can I use this library in my Electron app?.
There is also a link to Using Native Node Modules guide in Electron documentation to fully understand the problematic.
Hope it helps.
from nfc-pcsc.
Thanks, This fixed the problem
from nfc-pcsc.
Solved, but introduced a breaking change, see How do I require/import this library? in README.
from nfc-pcsc.
Related Issues (20)
- Mifare DESfire EV2 2k - error in step 2 - authenticate HOT 1
- Constructing APDU command on NTAG21x
- Error when writing data. Receives an Invalid data length error. HOT 3
- Authentication failed for same blocks BUT is Working in others HOT 1
- P2P Feature
- Empty Data
- Multi RFID Reader
- was compiled against a different Node.js version using NODE_MODULE_VERSION 111. This version of Node.js requires NODE_MODULE_VERSION 110. HOT 3
- UnhandledPromiseRejectionWarning: WriteError: Write operation failed: Status code: 0x6300 HOT 3
- I don't understand that code HOT 1
- Module not found: Error: Can't resolve 'fs' HOT 2
- Unable to run the basic example HOT 2
- Add disposition parameter in disconnect method
- MacOS installation issue using npm HOT 2
- Cannot access "events.EventEmitter" in client code HOT 4
- Context Aware Native Module, Electron Context Isolation and Node Integration Support
- Unsupported engine Please Help
- Emulate Tag NFC?
- Sveltekit build fails when running 'npm run build' but works on 'npm run dev' HOT 1
- It turned out to connect the library in CRA(React)? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nfc-pcsc.