svanderburg / node2nix

Generate Nix expressions to build NPM packages
MIT License
519 stars 99 forks source link

"SyntaxError: Unexpected token in JSON at position 0" while "pinpointing versions of dependencies..." for certain packages #159

Open colehaus opened 4 years ago

colehaus commented 4 years ago

I've created a repository reproducing the issue at https://github.com/colehaus/node2nix-test. The issue only arises for certain versions of certain packages.

svanderburg commented 4 years ago

I just checked and in my case this file was the culprit:

/nix/store/al9f6wrwysyravhz8qhhd0sijskc25h4-node_node2nix-test-0.1.0/lib/node_modules/node2nix-test/node_modules/paralleljs/package.json

turns out that the first byte is a weird UTF-8 character (0xEFBB). For some reason, JSON.parse() does not seem to accept it, but maybe for some strange reason NPM can.

I don't know yet what purpose it serves or how it can be fixed.