nfc-pcsc icon indicating copy to clipboard operation
nfc-pcsc copied to clipboard

new NFC() hangs on windows 10

Open fatmatto opened this issue 5 years ago • 9 comments

Hello,

I tried the example on the README file on a windows 10 tablet and it hangs on the line:

const nfc = new NFC(); 

Inspecting the code in the node_modules/nfc-pcsc/dist directory I found out that it blocks at the line following line in dist/NFC.js

this.pcsc = (0, _pcsclite.default)()

Which in turns blocks at the line

const p = new PCSCLite()

in @pokusew/pcsclite/lib/pcsclite.js

Is there anything that is required to make the library work on Windows 10?

The system configuration is

node v10.15.3
npm 6.4.1
Windows 10 Enterprise 

fatmatto avatar May 28 '19 15:05 fatmatto

Hi @fatmatto, it is known issue on Windows that can occur in some situations. See https://github.com/pokusew/node-pcsclite/issues/21.

The example was run on a Windows 10 (Pro) machine that had never had a smart card device plugged in to it. The example seems to run fine on Win 10 machines that have seen a smart card device.

Smart Card Service on Windows is not running by default and is only started when a NFC reader is connected (I tried to change this behavior, but it does not seem to be possible). This had been causing pcsclite (nfc-pcsc) to crash. I (my friend on Windows, I use macOS) did some fixes (https://github.com/pokusew/node-pcsclite/commit/9f871e90966d852e440ff62025ca4c70f72c8667) that seemed to fix the issue. Apparently, now in some configurations (e.g. on a machine that had never had a smart card device plugged in to it), the issue you describing occurs.

There is already a PR https://github.com/pokusew/node-pcsclite/pull/22 that is addressing this issue. Unfortunately, I haven't got enough time yet to examine it and eventually merge the fix.

Hope it helps. 🙂


As soon as I get some time (hopefully in a month or so), I try to look into this and merge the PR.

pokusew avatar May 28 '19 20:05 pokusew

Hi @pokusew Thank you for the reply, since i already used the NFC reader on that device (with a Windows native app) I assumed it counted as a smart card device previously plugged in :)

While you handle the PR i'll take a look at it and try with a fork of the repo.

Thank you for the repo and for your time :)

fatmatto avatar May 29 '19 06:05 fatmatto

Hello,

I have the same issue with windows 10, I tried to manually start the Smart Card service, but it didn't help.

Is this something that can be fixed?

Thank you very much!

cloudhx avatar Oct 28 '20 09:10 cloudhx

Hi,

Just tested the package on Windows 10 and it works well.

Thank you.

cloudhx avatar Dec 01 '20 15:12 cloudhx

Can you explain how did you fix this issue please? :)

kumarmboxuk avatar Jun 02 '21 13:06 kumarmboxuk

I am running into the same issue and it's unclear to me how to fix this.

[EDIT]

I have made sure I am running the latest version of this package. Tried with Node 14, Node 16 and Node 13 and all have the same issue. The program just hangs there forever.

@cloudhx @kumarmboxuk how did you fix this?

Fossil01 avatar Jun 23 '21 11:06 Fossil01

@Fossil01 @kumarmboxuk I'm using ACR122 reader and as I remembered you need to install the driver for it on Windows.

cloudhx avatar Jul 09 '21 11:07 cloudhx