pokusew / nfc-pcsc

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

Module not found: Error: Can't resolve 'fs' #143

Open sunnyso246 opened 1 year ago

sunnyso246 commented 1 year ago

Hi,

I add the library in my react project and always get this error. Please advise how to solve it.

ERROR in ./node_modules/bindings/bindings.js and Module not found: Error: Can't resolve 'fs' in node-modules.

Use react script 5.0.1 and webpack 5.

Thanks Sunny.

alexgoto commented 9 months ago

Hi,

I add the library in my react project and always get this error. Please advise how to solve it.

ERROR in ./node_modules/bindings/bindings.js and Module not found: Error: Can't resolve 'fs' in node-modules.

Use react script 5.0.1 and webpack 5.

Thanks Sunny.

fs is is Node.js provided context. React works inside browser, where Node.js context is unavailable.

This module works only in Node.js.

If we talk about the whole task - browser can not provide access to Smart Cards from JavaScript (React in your situation) directly. Is is possible only if host machine of user of your JavaScript provide some of interface for this. For example this interface is browser extension

danielduan commented 9 months ago

For anyone trying to run this in Electron, the nodeIntegration flag needs to be switched on to get access to fs