vuepress / core

Vue-Powered Static Site Generator
https://vuepress.vuejs.org
MIT License
2.35k stars 923 forks source link

[Bug report] SyntaxError: Unexpected token 'export' #1608

Closed liuhe32 closed 1 month ago

liuhe32 commented 2 months ago

Description

image "type": "module" write in package.json,but cannot run

in "theme-default\lib\node\index.js" what dependent?

Reproduction

https://vuepress.vuejs.org/zh/guide/getting-started.html#%E5%88%9B%E5%BB%BA%E9%A1%B9%E7%9B%AE

Used Package Manager

pnpm

System Info

node_modules\@vuepress\theme-default\lib\node\index.js:4
export * from './defaultTheme.js';
^^^^^^

SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1287:20)
    at Module._compile (node:internal/modules/cjs/loader:1339:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1434:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at cjsLoader (node:internal/modules/esm/translators:358:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:307:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)

Node.js v21.5.0
github-actions[bot] commented 2 months ago

Hello @liuhe32. Please provide a minimal reproduction using a GitHub repository or vuepress.vuejs.org/new. Issues marked with need reproduction will be closed if they have no activity within 7 days.

Mister-Hope commented 2 months ago

node21 is not an official support node version, use lts versions and try again with @next flag

liuhe32 commented 1 month ago

yeah,I have got it and changed v20.17.0(node),it work