目的:
构建/部署 nuxt3 项目并在我的 mac 上查看它。
使用的命令:
yarn build
> node ./server/index.mjs
在浏览器中导航到 url 后进入终端时出错:
[nuxt] [request error] [unhandled] [500] Cannot find module '/Users/mark/Desktop/project/.output/server/node_modules/vue/server-renderer/index.mjs' imported from /Users/mark/Desktop/project/.output/server/chunks/handlers/renderer.mjs
at finalizeResolution (node:internal/modules/esm/resolve:265:11)
at moduleResolve (node:internal/modules/esm/resolve:933:10)
at defaultResolve (node:internal/modules/esm/resolve:1157:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:390:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:359:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:234:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
at link (node:internal/modules/esm/module_job:86:36)
在开发模式下一切正常,
yarn build
不会抛出任何错误,然后当运行node ./server/index.mjs
并在浏览器中转到http://0.0.0.0:3000时,我收到错误500,我尝试安装一个带有干净 nuxt 应用程序的新项目,在构建相同的错误后
Mac系统(索诺玛14.1) 节点 v20.12.2
我打开.output/server并运行命令
yarn install
,它重新链接所有依赖项也给出了这个警告
warning " > @vue/[email protected]" has incorrect peer dependency "[email protected]".
及其工作。