astro-icon
astro-icon copied to clipboard
Error when evaluating SSR module "astro-icon"
What version of astro-icon are you using?
v1.1.0
Astro Info
Astro v4.13.2
Node v18.18.0
System macOS (arm64)
Package Manager npm
Output hybrid
Adapter @astrojs/cloudflare
Integrations @astrojs/tailwind
@astrojs/react
astro-auth
[!NOTE]
I had to take outastro-iconIntegration or it won't even run the command
If this issue only occurs in one browser, which browser is a problem?
Every
Describe the Bug
7:28:38 PM [vite] Error when evaluating SSR module /Users/***/Sites/***/astro.config.mjs: failed to import "astro-icon"
|- file:///Users/***/Sites/***/node_modules/@iconify/tools/lib/svg/index.mjs:1
import cheerio from 'cheerio';
^^^^^^^
SyntaxError: The requested module 'cheerio' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
[astro] Unable to load your Astro config
The requested module 'cheerio' does not provide an export named 'default'
Stack trace:
at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
What's the expected result?
It should work
Link to Minimal Reproducible Example
I was not able to recreate it on StackBlitz, but doing
npm create astro@latest
npx astro add astro-icon
npm run dev
It gives me the same error
I just started hitting this as well. The Astro build command is working fine, but I have a GitHub Action that runs vitests that started failing this afternoon with this error.
It has something to do with the latest release of Cheerio
https://github.com/cheeriojs/cheerio/releases/tag/v1.0.0
It was tagged 6 hours ago. This seems more like an issue with @iconify/tools
Facing this as well ππ½
Not sure how safe it is, but this worked for me (I'm just learning astro at this moment): I added this to the package.json and installed dependencies, "overrides": { "astro-icon": { "cheerio": "1.0.0-rc.12" } }
Not sure how safe it is, but this worked for me (I'm just learning astro at this moment): I added this to the package.json and installed dependencies, "overrides": { "astro-icon": { "cheerio": "1.0.0-rc.12" } }
Came to comment this.
Works as a temporary solution, will use this until they get fixed.
Another way to solve it temporarily is to use resolutions in package.json (I struggled to get the overrides thing to work in a monorepo):
"resolutions": { "cheerio": "1.0.0-rc.12" }
This problem is already solved in @iconify/tools version 4. Below overrides worked for me, and I think it is the better solution.
"overrides": {
"astro-icon": {
"@iconify/tools": "^4.0.0"
}
}
It worked for me by installing the latest version, npm install @iconify/tools --save
I still get an error without:
"resolutions": { "cheerio": "1.0.0-rc.12" }
@iconify/tools A new revised version 4.0.5 has been released
https://github.com/iconify/tools/commit/3d8d54b7dc36bf40526abaffcc12022c6d636eed
I'm having the same issue.
I still get an error without:
"resolutions": { "cheerio": "1.0.0-rc.12" }
Same here. It did not work by any other way...
@rderimay @adnansmajlovic If you added the @iconify/tools override, don't forget to run npm install again.
@rderimay @adnansmajlovic If you added the @iconify/tools override, don't forget to run
npm installagain.
yes sure. Did it. Event deleted the node_modules folder to be sureβ¦
On pnpm I had to do this instead
"pnpm": {
"overrides": {
"@iconify/tools": "^4.0.5"
}
}
On pnpm I had to do this instead
"pnpm": { "overrides": { "@iconify/tools": "^4.0.5" } }
Thanks! ππ» This is why it did not work as I am using pnpm. (ping @Stretsh)
still not fixed, astro still uses version 3.0.7 and even if you change the version to 4.0.5 I still get the error with cheerio...
For me it worked fine after using that override in my package.json and then running pnpm up --latest.
On pnpm I had to do this instead
"pnpm": { "overrides": { "@iconify/tools": "^4.0.5" } }Thanks! ππ» This is why it did not work as I am using pnpm. (ping @Stretsh)
Thanks The issue is solved now
"overrides": { "astro-icon": { "@iconify/tools": "^4.0.0" } }
Thanks The issue is solved now
This problem is already solved in @iconify/tools version 4. Below overrides worked for me, and I think it is the better solution.
"overrides": { "astro-icon": { "@iconify/tools": "^4.0.0" } }
This worked for me. Amazing thanks!
On pnpm I had to do this instead
"pnpm": { "overrides": { "@iconify/tools": "^4.0.5" } }
wow,thank you ,use code fix the bug
Facing same error and npm install @iconify/tools --save dint work for me
Seem to be fixed in [email protected] by https://github.com/natemoo-re/astro-icon/pull/230 bumping to @iconify/tools@^4.0.4
At least i don't have build issues anymore on my side
I believe this is resolved. Closing.