0

I have an astro website and starting today when I build locally 'astro dev/build' will report the following error.

OS: Windows10
Node version: v20.16.0
Package manager: Pnpm v9.7.0
Astro version: v4.13.1
Error Message:
[vite] Error when evaluating SSR module F:\oceanh_workspace\Project\blog-astro\astro.config.mjs: failed to import "astro-icon" |-file:///F:/oceanh_workspace/Project/blogastro/node_modules/.pnpm/@[email protected]/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 nodeImport (file:///F:/oceanh_workspace/Project/blog-astro/node_modules/.pnpm/[email protected]@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52928:15) at async ssrImport (file:///F:/oceanh_workspace/Project/blog-astro/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52786:16) at async eval (F:/oceanh_workspace/Project/blog-astro/astro.config.mjs:10:31) at async instantiateModule (file:///F:/oceanh_workspace/Project/blog-astro/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/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:///F:/oceanh_workspace/Project/blog-astro/node_modules/.pnpm/[email protected]@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52786:16) at async instantiateModule (file:///F:/oceanh_workspace/Project/blog-astro/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:52844:5) ELIFECYCLE  Command failed with exit code 1.

I've tried a lot of ways, like removing node_modules, clearing pnpm's cache, updating dependent versions, and even rolling back the code to previous versions, but nothing has fixed the problem, which drives me crazy.Plz help me.

1 Answer 1

1

This problem is solved in @iconify/tools version 4.

import cheerio from 'cheerio';import * as cheerio from 'cheerio';

If you are using astro-icon, this issue will also be helpful: https://github.com/natemoo-re/astro-icon/issues/231

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.