Workshape / icon-font-generator

Easy-to-use, pre-configured cli tool to generate webfont icon kits from a bunch of .svg files
MIT License
471 stars 76 forks source link

SyntaxError: Unexpected character "N" at index 42 #46

Open Clex1o1 opened 5 years ago

Clex1o1 commented 5 years ago

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
jstebenne commented 5 years ago

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

tancredi commented 5 years ago

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

arulkumarsd commented 5 years ago

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

fefanto commented 5 years ago

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.

rjlopezdev commented 5 years ago

Same error, fixed removing "transform" attribute.

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

aloy-chn commented 4 years ago

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.