nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
54.75k stars 5.01k forks source link

2.15.1 "Template src not found" crash #8860

Closed ThibaultVlacich closed 3 years ago

ThibaultVlacich commented 3 years ago

Versions

Reproduction

Running nuxt build with version 2.15.1 crashes with a "Template src not found" error. Everything is fine with 2.15.0

What is actually happening?

$ nuxt build
[fatal] Template src not found: <...>/node_modules/@nuxt/components/templates/components/readme.md
  at ModuleContainer.addTemplate (node_modules/@nuxt/core/dist/core.js:78:13)
  at node_modules/@nuxt/components/dist/index.js:223:63
  at processTicksAndRejections (internal/process/task_queues.js:97:5)
  at async Nuxt.callHook (node_modules/hable/dist/hable.js:1:959)
  at async Builder.build (node_modules/@nuxt/builder/dist/builder.js:296:5)
  at async Object.run (node_modules/@nuxt/cli/dist/cli-build.js:110:7)
  at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:413:7)

╭──────────────────────────────────────────────────────────────────────────────╮
││   ✖ Nuxt Fatal Error                                                       ││
││   Error: Template src not found:                                           ││
││   <...>/node_modules/@nuxt/components/templates/components/readme.md       ││
╰──────────────────────────────────────────────────────────────────────────────╯

error Command failed with exit code 1.
shin-sforzando commented 3 years ago

I was having the same problem, but I think I may have found the cause. It said there was no readme.md , so I used .yarnclean to keep *.md from being erased, and the problem went away. However /node_modules/@nuxt/components/templates/components/readme.md still doesn't exist, though. Anyway, I hope this helps you too.

$ git diff .yarnclean
diff --git a/.yarnclean b/.yarnclean
index b591611..cf96ec5 100644
--- a/.yarnclean
+++ b/.yarnclean
@@ -42,4 +42,4 @@ wercker.yml
 .travis.yml

 # misc
-*.md
+# *.md
ThibaultVlacich commented 3 years ago

Indeed, I am also using Yarn and have a .yarnclean file setup.

selfagency commented 3 years ago

I'm having this same problem right now trying to deploy to Vercel using 2.14.12.

selfagency commented 3 years ago

Just updated to 12.15.1 and also:

13:28:36 | [log]  ----------------- Nuxt build -----------------
13:28:37 | [log] Running nuxt build --standalone --no-lock --config-file "nuxt.config.js"
13:28:39 | [fatal] Template src not found: /vercel/workpath0/node_modules_dev/@nuxt/components/templates/components/readme.md
13:28:39 | at ModuleContainer.addTemplate (node_modules_dev/@nuxt/core/dist/core.js:78:13)
13:28:39 | at node_modules_dev/@nuxt/components/dist/index.js:223:63
13:28:39 | at processTicksAndRejections (internal/process/task_queues.js:93:5)
13:28:39 | at async Nuxt.callHook (node_modules_dev/hable/dist/hable.js:1:959)
13:28:39 | at async Builder.build (node_modules_dev/@nuxt/builder/dist/builder.js:296:5)
13:28:39 | at async Object.run (node_modules_dev/@nuxt/cli/dist/cli-build.js:110:7)
13:28:39 | at async NuxtCommand.run (node_modules_dev/@nuxt/cli/dist/cli-index.js:413:7)
13:28:39 | ╭──────────────────────────────────────────────────────────────────────────────╮│                                                                              ││   ✖ Nuxt Fatal Error                                                         ││                                                                              ││   Error: Template src not found:                                             ││   /vercel/workpath0/node_modules_dev/@nuxt/components/templates/components   ││   /readme.md                                                                 ││                                                                              │╰──────────────────────────────────────────────────────────────────────────────╯
13:28:39 | Error: Command failed with exit code 1: npx nuxt build --standalone --no-lock --config-file "nuxt.config.js"
13:28:39 | at makeError (/vercel/19fbb60e05b83155/.build-utils/.builder/node_modules/execa/lib/error.js:59:11)
13:28:39 | at handlePromise (/vercel/19fbb60e05b83155/.build-utils/.builder/node_modules/execa/index.js:114:26)
13:28:39 | at processTicksAndRejections (internal/process/task_queues.js:97:5)
13:28:39 | at async Object.build (/vercel/19fbb60e05b83155/.build-utils/.builder/node_modules/@nuxtjs/vercel-builder/lib/index.js:338:3)
13:28:39 | at async buildStep (/var/task/sandbox-worker.js:119040:24)
13:28:39 | at async /var/task/sandbox-worker.js:118726:27 {
13:28:39 | shortMessage: 'Command failed with exit code 1: npx nuxt build --standalone --no-lock --config-file "nuxt.config.js"',
13:28:39 | command: 'npx nuxt build --standalone --no-lock --config-file "nuxt.config.js"',
13:28:39 | exitCode: 1,
13:28:39 | signal: undefined,
13:28:39 | signalDescription: undefined,
13:28:39 | stdout: undefined,
13:28:39 | stderr: undefined,
13:28:39 | failed: true,
13:28:39 | timedOut: false,
13:28:39 | isCanceled: false,
13:28:39 | killed: false
13:28:39 | }

You get the same error even if you install @nuxt/components as a dependency explicitly.

selfagency commented 3 years ago

So the folks who maintain @nuxt/vercel-builder identified this issue as well and a temporary fix:

Add to your package.json:

"resolutions": {
  "nuxt/@nuxt/components": "2.0.0"
}
pi0 commented 3 years ago

Hi. Thanks for reporting issue. Since default yarn clean removes all markdown files (and we use yarn clean for vercel builder) had to change template extension. Issue is solved by components@2.1.1. You can get the update using yarn upgrade nuxt or recreating lockfile.