Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when evaluating SSR module "astro-icon" #231

Closed
jjjrmy opened this issue Aug 9, 2024 · 25 comments
Closed

Error when evaluating SSR module "astro-icon" #231

jjjrmy opened this issue Aug 9, 2024 · 25 comments

Comments

@jjjrmy
Copy link

jjjrmy commented Aug 9, 2024

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 out astro-icon Integration 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

@richklein-wf
Copy link

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.

@jjjrmy
Copy link
Author

jjjrmy commented Aug 10, 2024

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

@manuraj17
Copy link

Facing this as well 👍🏽

@Bran-mf
Copy link

Bran-mf commented Aug 10, 2024

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"
}
}

@manuraj17
Copy link

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.

@smorgrav
Copy link

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" }

@Lich496
Copy link

Lich496 commented Aug 11, 2024

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"
    }
  }

@gilbertoxdev
Copy link

It worked for me by installing the latest version, npm install @iconify/tools --save

@adnansmajlovic
Copy link

I still get an error without:

"resolutions": { "cheerio": "1.0.0-rc.12" }

JAAKKQ added a commit to JAAKKQ/karkkainen.net that referenced this issue Aug 11, 2024
@EveSunMaple
Copy link

EveSunMaple commented Aug 11, 2024

@iconify/tools A new revised version 4.0.5 has been released

iconify/tools@3d8d54b

@ameneses67
Copy link

I'm having the same issue.

diogotcorreia added a commit to xperience-house/website that referenced this issue Aug 11, 2024
@rderimay
Copy link

I still get an error without:

"resolutions": { "cheerio": "1.0.0-rc.12" }

Same here. It did not work by any other way...

@Stretsh
Copy link

Stretsh commented Aug 12, 2024

@rderimay @adnansmajlovic If you added the @iconify/tools override, don't forget to run npm install again.

@rderimay
Copy link

rderimay commented Aug 12, 2024

@rderimay @adnansmajlovic If you added the @iconify/tools override, don't forget to run npm install again.

yes sure. Did it. Event deleted the node_modules folder to be sure…

@VisualEhrmanntraut
Copy link

On pnpm I had to do this instead

  "pnpm": {
    "overrides": {
      "@iconify/tools": "^4.0.5"
    }
  }

@rderimay
Copy link

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)

yizhenme added a commit to yizhenme/yizhenwang that referenced this issue Aug 12, 2024
@iEscapedVim
Copy link

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...

@VisualEhrmanntraut
Copy link

For me it worked fine after using that override in my package.json and then running pnpm up --latest.

@sreejithkalarikkal
Copy link

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

rol4nd909 added a commit to rol4nd909/astro-space-travel that referenced this issue Aug 13, 2024
@yangjuzi
Copy link

"overrides": {
"astro-icon": {
"@iconify/tools": "^4.0.0"
}
}

Thanks The issue is solved now

@sukantg
Copy link

sukantg commented Aug 14, 2024

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!

@DerickIT
Copy link

On pnpm I had to do this instead

  "pnpm": {
    "overrides": {
      "@iconify/tools": "^4.0.5"
    }
  }

wow,thank you ,use code fix the bug

@snimavat
Copy link

Facing same error and npm install @iconify/tools --save dint work for me

@Chrissdroid
Copy link

Seem to be fixed in astro-icon@1.1.1 by #230 bumping to @iconify/tools@^4.0.4

At least i don't have build issues anymore on my side

@stramel
Copy link
Collaborator

stramel commented Oct 22, 2024

I believe this is resolved. Closing.

@stramel stramel closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests