Upon initializing my vitepress project with the latest version using pnpm, I attempted to run it with pnpm run docs:dev
. However, errors popped up:
✘ [ERROR] "vitepress" resolved to an ESM file. ESM file cannot be loaded by `require`. Refer to http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details. [plugin externalize-deps]
node_modules/.pnpm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ec899f8e99858088acdcc2ddd4c2dedc">[email protected]</a>/node_modules/esbuild/lib/main.js:1373:27:
1373 │ let result = await callback({
╵ ^
at file:///C:/Users/CoolPlayLin/Project/ChatGPT-Wiki/node_modules/.pnpm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e99f809d8ca9ddc7ddc7d0">[email protected]</a>/node_modules/vite/dist/node/chunks/dep-df561101.js:66190:35
at requestCallbacks.on-resolve (C:\Users\CoolPlayLin\Project\ChatGPT-Wiki\node_modules\.pnpm\<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fa9f89988f93969ebacad4cbc2d4c8ca">[email protected]</a>\node_modules\esbuild\lib\main.js:1373:28)
at handleRequest (C:\Users/CoolPlayLin/Project/ChatGPT-Wiki\node_modules/.pnpm\<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="76130514031f1a12364658474e584446">[email protected]</a>\node_modules\esbuild\lib\main.js:729:19)
...
The plugin "externalize-deps" was triggered by this import
docs/.vitepress/config.js:1:382:
1 │ ...olPlayLin/Project/ChatGPT-Wiki/docs/.vitepress/config.js";import { defineConfig } from 'vitepress'
failed to load config from C:\Users/CoolPlayLin/Project/ChatGPT-Wiki\docs/.vitepress\config.js
...
ELIFECYCLE Command failed with exit code 1.
How can I resolve these errors?
I tried running the command pnpm run docs:dev
hoping for a successful execution.