icon-font-generator icon indicating copy to clipboard operation
icon-font-generator copied to clipboard

SyntaxError: Unexpected character "N" at index 42

Open Clex1o1 opened this issue 5 years ago • 6 comments

Generating font kit from 9 SVG icons
events.js:167
      throw er; // Unhandled 'error' event
      ^

SyntaxError: Unexpected character "N" at index 42.
    at SVGPathDataParser._transform (/usr/local/lib/node_modules/icon-font-generator/node_modules/svg-pathdata/src/SVGPathDataParser.js:461:28)
    at SVGPathDataParser.Transform._read (/usr/local/lib/node_modules/icon-font-generator/node_modules/svg-pathdata/node_modules/readable-stream/lib/_stream_transform.js:159:10)
    at SVGPathDataParser.Transform._write (/usr/local/lib/node_modules/icon-font-generator/node_modules/svg-pathdata/node_modules/readable-stream/lib/_stream_transform.js:147:83)
    at doWrite (/usr/local/lib/node_modules/icon-font-generator/node_modules/svg-pathdata/node_modules/readable-stream/lib/_stream_writable.js:313:64)
    at writeOrBuffer (/usr/local/lib/node_modules/icon-font-generator/node_modules/svg-pathdata/node_modules/readable-stream/lib/_stream_writable.js:302:5)
    at SVGPathDataParser.Writable.write (/usr/local/lib/node_modules/icon-font-generator/node_modules/svg-pathdata/node_modules/readable-stream/lib/_stream_writable.js:241:11)
    at Function.SVGPathData.parse (/usr/local/lib/node_modules/icon-font-generator/node_modules/svg-pathdata/src/SVGPathData.js:124:10)
    at new SVGPathData (/usr/local/lib/node_modules/icon-font-generator/node_modules/svg-pathdata/src/SVGPathData.js:4:31)
    at /usr/local/lib/node_modules/icon-font-generator/node_modules/svgicons2svgfont/src/index.js:335:20
    at Array.forEach (<anonymous>)
Emitted 'error' event at:
    at SVGPathDataParser._transform (/usr/local/lib/node_modules/icon-font-generator/node_modules/svg-pathdata/src/SVGPathDataParser.js:461:14)
    at SVGPathDataParser.Transform._read (/usr/local/lib/node_modules/icon-font-generator/node_modules/svg-pathdata/node_modules/readable-stream/lib/_stream_transform.js:159:10)
    [... lines matching original stack trace ...]
    at Array.forEach (<anonymous>)```

npm -v 
6.4.1

node -v
v10.12.0

Clex1o1 avatar Oct 23 '18 19:10 Clex1o1

I'm having the same problem. I found that only specific SVG files are throwing this error

jstebenne avatar Oct 29 '18 20:10 jstebenne

Can I get the SVGs you guys are using? It looks to me from a brief look as if some SVG data might be corrupted

tancredi avatar Jan 13 '19 18:01 tancredi

Same issue.. I am sending the svg file.. left-arrow.svg.zip

arulkumarsd avatar Mar 19 '19 09:03 arulkumarsd

just stumbled upon this error and (in my particular case) fixed by cutting out svgs that had a "transform" element inside the path e.g. rotation.

fefanto avatar May 13 '19 13:05 fefanto

Same error, fixed removing "transform" attribute.

I applied a regex in vscode to delete all ocurriences, could be useful: transform=(".+?")

rjlopezdev avatar May 18 '19 20:05 rjlopezdev

Same error, fixed removing "transform" attribute.

I applied a regex in vscode to delete all ocurriences, could be useful: transform=(".+?")

@rjlopezdev Your fix worked for me.

aloy-chn avatar Oct 01 '19 06:10 aloy-chn