Nuxt application deploy failing

Hi there,
Hope someone can point me in the right direction

see screenshot below:

At the end of my deploy I get the following error in the deploy logs:
[nuxt] [request error] [unhandled] [500] Cannot find module ‘/opt/render/project/src/frontend/.output/server/node_modules/vue/server-renderer/index.mjs’ imported from /opt/render/project/src/frontend/.output/server/chunks/routes/renderer.mjs

Tried different node and yarn versions hoping that might do the trick but that was unfortunately not the case.

Any idea what I could try to fix this?

Hi there,

A couple things to check:

  1. Ensure node_modules is not checked into your Git repository, as it will get built out dynamically during the build process
  2. Verify that all module references in your code match the casing and spelling of all paths and files precisely (and line up with what’s checked into the repository), as Linux is case sensitive

Hope that helps!

Regards,
Mike


Render Support Engineer, MT (UTC-6, UTC-7 in Winter)

Thank you for the quick response Mike.
I double checked both your suggestions. node_modules are not checked into git and module references should be fine.

My next approach will probably be:
Deploy a barebones nuxt application. If I succeed in that I will start stripping down my current project until I find the problem.

If you have any other ideas/suggestions, please let me know.

The only other suggestion that comes to mind is to ensure all the dependencies referenced in your code are properly installed, and have versions matching those working in your local environment. With a 500 error, it’s definitely an internal application issue at the end of the day.

Hope you have a great weekend coming up!

Regards,
Mike


Render Support Engineer, MT (UTC-6, UTC-7 in Winter)

So after easily deploying a barebones nuxt application and then stripping down my application until only the index page and default npm packages were left, I found the issue.

I added the following in my .gitignore:

.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.yarn/build-state.yml

Then I ran:
git rm -r --cached .yarn

This helped me remove install-state.gz from my repo which seems to have solved my problem.

On Questions & Answers | Yarn I found the following information about this file:
.yarn/install-state.gz is an optimization file that you shouldn’t ever have to commit. It simply stores the exact state of your project so that the next commands can boot without having to resolve your workspaces all over again.

Guess I learned something new again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.