我遇到了一个相当奇怪的问题

The problem: when I run the "nuxt build" command, the generated .output folder contains nothing:

Nuxt3 build .output empty

.output/public/ => empty

.output/server/ => empty

.output/nitro.json => {
  "date": "2024-04-22T11:47:26.045Z",
  "preset": "nitro-prerender",
  "framework": {
    "name": "nuxt",
    "version": "3.11.2"
  },
  "versions": {
    "nitro": "2.9.6"
  },
  "commands": {
    "preview": "npx serve ./public"
  }
}

就是这样.

"nuxt构建"期间没有特定的错误消息,日志(log)似乎完全正常,除了几个警告:

> nuxt build

Nuxt 3.11.2 with Nitro 2.9.6                                                                        13:45:51
ℹ Using default Tailwind CSS file                                                 nuxt:tailwindcss 13:45:55
ℹ Compiled types/plugins.d.ts in 513.17ms                                                          13:45:58
ℹ Compiled plugins/client.mjs in 520.62ms                                                          13:45:58
ℹ Building client...                                                                               13:46:00
ℹ vite v5.2.8 building for production...                                                           13:46:00
ℹ ✓ 3137 modules transformed.                                                                      13:46:24   
ℹ ../.nuxt/dist/client/manifest.json                              119.60 kB │ gzip:  12.12 kB      13:46:27
ℹ ../.nuxt/dist/client/_nuxt/ProseCode.CchFRBtv.css                 0.05 kB │ gzip:   0.07 kB      13:46:27   
[...]
ℹ ../.nuxt/dist/client/_nuxt/CBDlt6eF.js                            0.08 kB │ gzip:   0.09 kB      13:46:27   

 WARN                                                                                               13:46:28  
(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.

ℹ ✓ built in 27.67s                                                                                13:46:28   
✔ Client built in 27691ms                                                                          13:46:28
ℹ Building server...                                                                               13:46:28   
ℹ vite v5.2.8 building SSR bundle for production...                                                13:46:28   
ℹ ✓ 1049 modules transformed.                                                                      13:46:49   
ℹ ../.nuxt/dist/server/_nuxt/edit-styles.CJoRU4Dt.mjs                          0.08 kB             13:46:53   
[...]  
ℹ ../.nuxt/dist/server/_nuxt/entry-styles.BrPVGxv3.mjs                         0.34 kB             13:46:53
ℹ ../.nuxt/dist/server/styles.mjs                                              8.52 kB             13:46:53   
[13:46:53] ℹ ../.nuxt/dist/server/_nuxt/edit-styles-1.mjs-WlIG5L6R.js                     0.20 kB │ map:   0.11 kB
[...]
[13:46:54] ℹ ../.nuxt/dist/server/_nuxt/edit-K-fzoRQv.js                                436.49 kB │ map: 101.57 kB
ℹ ✓ built in 26.26s                                                                                13:46:54   
✔ Server built in 26335ms                                                                          13:46:54
ℹ Initializing prerenderer                                                                   nitro 13:46:54

[13:47:22]  WARN  "file:///C:/dev/.................../node_modules/nuxt/dist/core/runtime/nitro/cache-driver.js" is imported by "virtual:#internal/nitro/virtual/storage", but could not be resolved – treating it as an external dependency.

ℹ Prerendering 1 routes

生成.nuxt/文件夹并正确填充了其中预期的所有代码,但随后不会将任何内容复制到. put文件夹中.

这导致启动服务器node .output/server/index.mjs的命令失败,因为index.mjs不存在.


node:internal/modules/cjs/loader:1147
  throw err;
  ^

Error: Cannot find module 'C:\dev\........\.output\server\index.mjs'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.11.0

Do you have any idea why nothing is generated in my .output? I suspect there must be a configuration error somewhere?

其他可能相关的信息:

  • 使用的版本: node v20.11.0、nuxt v3.11.2、nitro v2.9.6、vite v5.2.8
  • 通过"nuxt dev"启动该Web应用程序即可正常工作."
  • 通过使用nuxt start命令创建的全新测试项目,运行nuxt构建时,. put文件夹将按预期正确填充

如果需要,很乐意分享更多相关信息或文件:)

提前感谢您的帮助!!🙏

推荐答案

Not the perfect answer, but I manged to fix it. Happy to give kudos to someone that could explain it !

我通过创建一个全新的nuxt项目(有nuxt init个)来成功实现这一目标,该项目开箱即用即可运行良好,然后将我的项目中的所有文件和文件夹复制到该新项目中.

我仍然不知道为什么它一开始就不起作用,而且即使根据GIT,似乎也没有什么区别.🤔

然而,完成此操作后,正如预期的那样,它现在在. select文件夹中正确生成了!

Vue.js相关问答推荐

如何在Vue 3中将动态特性从主零部件同步到子零部件

如何只提取一次用于无线电组过滤的数据,而不是针对数据库中的每个条目提取数据?

是否可以使用 Vuetify/VueJS 为轮播设置默认图像而不是第一个图像?

如何将字符串中的
解析为 VUE.js 中的 html 标记

VueJS中的绑定函数含义

我是否必须在 Vue 3 中使用 Composition API,还是仍然可以使用Vue 2的方式工作?

自定义props类型

VueJS + Typescript:类型上不存在属性

vuejs中通过变量动态调用方法

在 v-for 循环中使用 v-model

[Vue 警告]:无效的props:propsscrollThreshold的类型判断失败.期望的数字,得到字符串

加载时焦点文本框上的 Vue.js

使用 nuxt,如何将路由名称放在页面标题中?

即使在生产模式下构建,VueJS 也会显示开发模式开发模式消息

Vuex:无法读取未定义的属性'$store'

如何在 JEST 测试中模拟全局 Vue.js 变量

如何从组件内的单点捕获 vuejs 错误

Vue 2 转换不起作用

Vue-i18n - 无法读取未定义的属性配置

v-bind:class 的 Vue.js 计算(computed)属性