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

[vite] Error when evaluating SSR module D:\VSCODE\astro-blog\astro.config.mjs: failed to import "astro-icon" #232

Closed
namezzy opened this issue Aug 14, 2024 · 5 comments

Comments

@namezzy
Copy link

namezzy commented Aug 14, 2024

What version of astro-icon are you using?

"astro-icon": "^1.1.0"

Astro Info

{
  "name": "astro-blog",
  "type": "module",
  "version": "0.0.1",
  "private": true,
  "browerslist": [
    "defaults"
  ],
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro build",
    "preview": "astro preview",
    "astro": "astro"
  },
  "dependencies": {
    "astro": "^4.13.2",
     "@iconify/tools": "^4.0.5",
    "astro-icon": "^1.1.0",
    "postcss": "^8.4.41",
    "postcss-preset-env": "^10.0.0"
  }
}

If this issue only occurs in one browser, which browser is a problem?

Chrome

Describe the Bug

PS D:\VSCODE\astro-blog> npm run dev

[email protected] dev
astro dev

17:52:50 [vite] Error when evaluating SSR module D:\VSCODE\astro-blog\astro.config.mjs: failed to import "astro-icon"
|- file:///D:/VSCODE/astro-blog/node_modules/astro-icon/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:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async nodeImport (file:///D:/VSCODE/astro-blog/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52928:15)
at async ssrImport (file:///D:/VSCODE/astro-blog/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52786:16)
at async eval (D:/VSCODE/astro-blog/astro.config.mjs:4:31)
at async instantiateModule (file:///D:/VSCODE/astro-blog/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52844: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:134:21)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async ssrImport (file:///D:/VSCODE/astro-blog/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52786:16)
at async instantiateModule (file:///D:/VSCODE/astro-blog/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52844:5)

What's the expected result?

PS D:\VSCODE\astro-blog> npm run dev

[email protected] dev
astro dev

17:52:50 [vite] Error when evaluating SSR module D:\VSCODE\astro-blog\astro.config.mjs: failed to import "astro-icon"
|- file:///D:/VSCODE/astro-blog/node_modules/astro-icon/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:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async nodeImport (file:///D:/VSCODE/astro-blog/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52928:15)
at async ssrImport (file:///D:/VSCODE/astro-blog/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52786:16)
at async eval (D:/VSCODE/astro-blog/astro.config.mjs:4:31)
at async instantiateModule (file:///D:/VSCODE/astro-blog/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52844: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:134:21)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async ssrImport (file:///D:/VSCODE/astro-blog/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52786:16)
at async instantiateModule (file:///D:/VSCODE/astro-blog/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52844:5)

Link to Minimal Reproducible Example

no

@san4d
Copy link

san4d commented Aug 14, 2024

Debugging Info: I ran into this after running a pnpm upgrade. When I updated the versions in my package.json manually, this issue doesn't arise.

Looking at the lockfile, it seems @iconify/utils was updated from 2.1.22 to 2.1.30 and cheerio was updated from 1.0.0-rc.12 to 1.0.0.

Astro Icon uses iconify-tools at 3.0. Version 4.0 brings in cheerio 1.0.0.

@mrdankuta
Copy link

I updated to '@iconify/[email protected]' and cheerio is on 1.0.0...but I still get the same error: SyntaxError: The requested module 'cheerio' does not provide an export named 'default'

This happens when building in Netlify. But it builds successfully locally.

@m4rrc0
Copy link

m4rrc0 commented Aug 16, 2024

Until this gets fixed, I was able to temporarily fix my builds by forcing [email protected] .
Make sure to use the specific version (you don't have a ^ in front of the version number in your package.json)
And rm -rf node_modules package-lock.json

@frenicohansen
Copy link

frenicohansen commented Aug 16, 2024

This should be fixed in 1.1.1

@m4rrc0
Copy link

m4rrc0 commented Aug 17, 2024

This should be fixed in 1.1.1

Confirmed on my side. Thanks!

@stramel stramel closed this as completed Aug 17, 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

Successfully merging a pull request may close this issue.

6 participants