NJAldwin / eleventy-plugin-gen-favicons

Favicon generator plugin for eleventy
MIT License
15 stars 4 forks source link

Expected number between 1 and 100000 for density but received 0.5625 of type number #7

Open hdchieh opened 1 year ago

hdchieh commented 1 year ago

https://github.com/oleeskild/digitalgarden/issues/161#issue-1720210146

/opt/build/repo/src/site/_includes/components/pageheader.njk

34 35 {% favicons './src/site/favicon.svg', appleIconBgColor='#123' %} 36


6:06:49 PM: [11ty] Template render error: (/opt/build/repo/src/site/_includes/components/pageheader.njk)
6:06:49 PM: [11ty] EleventyShortcodeError: Error with Nunjucks shortcode favicons (via Template render error)
6:06:49 PM: [11ty] 3. Expected number between 1 and 100000 for density but received 0.5625 of type number (via Template render error)
6:06:49 PM: [11ty]
6:06:49 PM: [11ty] Original error stack trace: Error: Expected number between 1 and 100000 for density but received 0.5625 of type number
6:06:49 PM: [11ty] at Object.invalidParameterError (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/node_modules/sharp/lib/is.js:124:10)
6:06:49 PM: [11ty] at Sharp._createInputDescriptor (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/node_modules/sharp/lib/input.js:92:18)
6:06:49 PM: [11ty] at new Sharp (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/node_modules/sharp/lib/constructor.js:341:29)
6:06:49 PM: [11ty] at Sharp (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/node_modules/sharp/lib/constructor.js:169:12)
6:06:49 PM: [11ty] at resizedSharp (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/favicon-gen.js:34:10)
6:06:49 PM: [11ty] at /opt/build/repo/node_modules/eleventy-plugin-gen-favicons/favicon-gen.js:41:33
6:06:49 PM: [11ty] at Array.map ()
6:06:49 PM: [11ty] at icoBuf (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/favicon-gen.js:41:20)
6:06:49 PM: [11ty] at module.exports (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/favicon-gen.js:92:7)
6:06:49 PM: [11ty] at async Object. (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/index.js:25:28)
6:06:50 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:06:49 PM: [11ty] Copied 29 files / Wrote 0 files in 0.42 seconds (v2.0.1)
6:06:49 PM: ERROR: "build:eleventy" exited with 1.
6:06:49 PM: ​
6:06:49 PM: "build.command" failed
6:06:49 PM: ────────────────────────────────────────────────────────────────

The .svg file used. favicon

NJAldwin commented 5 months ago

It looks like the underlying issue may be that the svg is not square: https://github.com/oleeskild/digitalgarden/issues/161#issuecomment-1712891613

I can look into whether there is either a solution for this or whether I can at least provide a better error message.