vercel-builder: Error deploying Nuxt.js application

Hello,

I’m trying to deploy a new Nuxt.js (v2.15.0) SSR application into Vercel, however I’m getting a lot of errors. I tried a few things that I saw in #369 , #425 which is basically set a fixed version at "@nuxtjs/vercel-builder", however none of then worked, I get the same errors everytime.

Function logs

[GET] /
17:33:20:30
2021-02-20T20:33:20.581Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'esm'\nRequire stack:\n- /var/task/vercel__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","stack":["Runtime.ImportModuleError: Error: Cannot find module 'esm'","Require stack:","- /var/task/vercel__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at _loadUserApp (/var/runtime/UserFunction.js:100:13)","    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)","    at Object.<anonymous> (/var/runtime/index.js:43:30)","    at Module._compile (internal/modules/cjs/loader.js:1063:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)","    at Module.load (internal/modules/cjs/loader.js:928:32)","    at Function.Module._load (internal/modules/cjs/loader.js:769:14)","    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)","    at internal/main/run_main_module.js:17:47"]}
Unknown application error occurred
Runtime.ImportModuleError

[HEAD] /
17:33:09:09
2021-02-20T20:33:09.353Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'esm'\nRequire stack:\n- /var/task/vercel__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","stack":["Runtime.ImportModuleError: Error: Cannot find module 'esm'","Require stack:","- /var/task/vercel__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at _loadUserApp (/var/runtime/UserFunction.js:100:13)","    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)","    at Object.<anonymous> (/var/runtime/index.js:43:30)","    at Module._compile (internal/modules/cjs/loader.js:1063:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)","    at Module.load (internal/modules/cjs/loader.js:928:32)","    at Function.Module._load (internal/modules/cjs/loader.js:769:14)","    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)","    at internal/main/run_main_module.js:17:47"]}
Unknown application error occurred
Runtime.ImportModuleError

[GET] /favicon.ico
17:33:21:04
2021-02-20T20:33:21.330Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'esm'\nRequire stack:\n- /var/task/vercel__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","stack":["Runtime.ImportModuleError: Error: Cannot find module 'esm'","Require stack:","- /var/task/vercel__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at _loadUserApp (/var/runtime/UserFunction.js:100:13)","    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)","    at Object.<anonymous> (/var/runtime/index.js:43:30)","    at Module._compile (internal/modules/cjs/loader.js:1063:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)","    at Module.load (internal/modules/cjs/loader.js:928:32)","    at Function.Module._load (internal/modules/cjs/loader.js:769:14)","    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)","    at internal/main/run_main_module.js:17:47"]}
Unknown application error occurred
Runtime.ImportModuleError

vercel.json

{
  "version": 2,
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/vercel-builder",
      "config": {
        "serverFiles": ["package.json"]
      }
    }
  ],
  "routes": [
    {
      "src": "/_nuxt/.+",
      "headers": {
        "Cache-Control": "public, max-age=31557600"
      }
    },
    {
      "src": "/sw.js",
      "dest": "/_nuxt/static/sw.js",
      "headers": {
        "Cache-Control": "public, max-age=43200, immutable",
        "Service-Worker-Allowed": "/"
      }
    },
    {
      "src": "^/(.*)",
      "dest": "/"
    }
  ]
}

Any help would be much appreciated. Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 26 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@guastallaigor Possibly you didn’t add the additional file to serverFiles in your config?

@rahulkumarsingh73690 If you are experiencing an issue, please create an issue with a reproduction, and I will have a look. ♥️

@petedermott You don’t need redirect-ssl on Vercel as it already redirects to SSL.

@danielroe Thanks for much for the tip about serverFiles, completely missed that. It works now, so for me, it was user error. It took quite some time to figure it out, so improved error messages would be nice. Greatly appreciate it!

@sstottelaar Are those external files listed in your serverFiles?

I tried using nuxt v2.14.12 but now It’s showing this error Screenshot from 2021-02-27 12-00-27 I used vuetify ui library by create-netlify-app

Fixed it by moving vuetify from devDependency to dependency