Rush / Font-Awesome-SVG-PNG

Font Awesome split to individual SVG and PNG files of different sizes along with Node.JS based generator
MIT License
3.22k stars 1.67k forks source link

Cannot read property 'charCodeAt' of undefined #62

Closed pooya1361 closed 7 years ago

pooya1361 commented 8 years ago

Hi, I get this error meesage when I run the following command in terminal: font-awesome-svg-png --color white --no-png Error message: Cought error TypeError: Cannot read property 'charCodeAt' of undefined at /usr/local/lib/node_modules/font-awesome-svg-png/lib/getFontData.js:20:39 at tryCatcher (/usr/local/lib/node_modules/font-awesome-svg-png/node_modules/bluebird/js/main/util.js:26:23) at MappingPromiseArray._promiseFulfilled (/usr/local/lib/node_modules/font-awesome-svg-png/node_modules/bluebird/js/main/map.js:56:38) at MappingPromiseArray.init (/usr/local/lib/node_modules/font-awesome-svg-png/node_modules/bluebird/js/main/promise_array.js:92:18) at Promise._settlePromiseAt (/usr/local/lib/node_modules/font-awesome-svg-png/node_modules/bluebird/js/main/promise.js:582:21) at Promise._settlePromises (/usr/local/lib/node_modules/font-awesome-svg-png/node_modules/bluebird/js/main/promise.js:700:14) at Async._drainQueue (/usr/local/lib/node_modules/font-awesome-svg-png/node_modules/bluebird/js/main/async.js:123:16) at Async._drainQueues (/usr/local/lib/node_modules/font-awesome-svg-png/node_modules/bluebird/js/main/async.js:133:10) at Immediate.Async.drainQueues (/usr/local/lib/node_modules/font-awesome-svg-png/node_modules/bluebird/js/main/async.js:15:14) at runCallback (timers.js:637:20) at tryOnImmediate (timers.js:610:5) at processImmediate [as _immediateCallback] (timers.js:582:5)

gdewald commented 7 years ago

Same issue. I was able to work around by setting the version of FontAwesome to 4.5.0 in package.json. Most likely the new version broke the script.

rinogo commented 7 years ago

I can confirm that this works.

However, in order for the "fix" to work, you can't use the "binary" in your path. You have to call it directly using Node.

Will not work:

font-awesome-svg-png --list

Will work:

node font-awesome-svg-png.js --list
rinogo commented 7 years ago

Update: The code successfully runs, but only generates a bunch of empty (blank) .png files for me... Fortunately, I can use the intact .svg versions to create .png versions...

Edit: I was able to get it working. As I recall, I think the problem with the blank .png files is that I needed to put my hex code color in quotes.

HyramTang commented 7 years ago

@gdewald Can you tell me where to modify the code?

joshdavenport commented 7 years ago

@HyramTang Probably /usr/local/lib/node_modules/font-awesome-svg-png/ but you can find out for sure in the first line of the trace, like the one pasted in the first message of this issue. cd there and edit the font-awesome dependency to "4.5.0" in package.json. Then npm install (might need to sudo)

visualsbysina commented 7 years ago

Unable to get this working after changing the version to"4.7.0"in package.json. After running npm install I get:

npm WARN enoent ENOENT: no such file or directory, open '/Users/sinahassan/package.json'
npm WARN sinahassan No description
npm WARN sinahassan No repository field.
npm WARN sinahassan No README data
npm WARN sinahassan No license field.

Any ideas?

svnm commented 7 years ago

thanks @gdewald

cd /usr/local/lib/node_modules/font-awesome-svg-png/ nano package.json update font-awesome to 4.5.0 save and exit npm i then it all worked fine

kiwina commented 7 years ago

This is because there are changes in the 4.7 file. Use this repo tupadr3/Font-Awesome-SVG-PNG

zhangbg commented 7 years ago

@joshdavenport Your solution is good for me. Thanks! image

Rush commented 7 years ago

Thank you for everybody participating and I apologize for not attending to this repo. Hopefully this latest update amends my absence. Newest version should address all problems.