question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error deploying Nuxt.js application

See original GitHub issue

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.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
danielroecommented, Feb 21, 2021

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

1reaction
rahulkumarsingh73690commented, Jun 25, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt app failed heroku deployement code=H10 error
I'm trying to deploy my ecommerce nuxt app to heroku. Here's exactly what I did heroku create myapplok heroku buildpacks:set heroku/nodejs ...
Read more >
Commands and Deployment - Nuxt
Use it for Node.js hosting like Heroku, Digital Ocean, etc. ... To deploy a SSR application we use target: 'server' , where server...
Read more >
An ultimate guide to CICD for your Nuxt.js Application
This tutorial will demonstrate how to build, test, and deploy your Nuxt.js Application to GitHub Pages using CircleCI.
Read more >
Deployment · Get Started with Nuxt
Deployment. A Nuxt application can be deployed on a Node.js server, pre-rendered for static hosting, or deployed to serverless or edge (CDN) environments....
Read more >
Deploy Nuxt 3 sites with universal rendering on Azure Static ...
When you build a Nuxt.js site using npm run build , the app is built as a traditional web app, not a static...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found