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.

[RC.5] Rollup error: Could not load `.nuxt/dist/server/server.mjs`

See original GitHub issue

Environment

Nuxt CLI v3.0.0-rc.5 RootDir: /home/max/Projects/<hidden_name_of_project> Nuxt project info:


  • Operating System: Linux
  • Node Version: v18.4.0
  • Nuxt Version: 3.0.0-rc.5
  • Package Manager: yarn@3.2.0
  • Builder: vite
  • User Config: css, modules, typescript, buildModules, plugins, vite, runtimeConfig
  • Runtime Modules: (), ()
  • Build Modules: @pinia/nuxt@0.1.9

Reproduction

Unfortunately I cannot reproduce this with clear project (and cannot full project code as it’s not open source), however project was buildable with 3.0.0-rc.4 version, so I believe it’s not problem with project’s codebase.

Describe the bug

Nuxt CLI v3.0.0-rc.5 is not able to clear build project at the first time (no node_modules, .nuxt, .output directories in project dir). Running yarn build (after yarn install ofc) cause following error:

Nuxt CLI v3.0.0-rc.5
ℹ Vite client warmed up in 4351ms                                                                                                                                                                                                                                
ℹ Client built in 16800ms                                                                                                                                                                                                                                        
ℹ Building server...                                                                                                                                                                                                                                             
✔ Server built in 90ms                                                                                                                                                                                                                                           
✔ Generated public .output/public                                                                                                                                                                                                                          
start Building server...                                                                                                                                                                                                                                   

 ERROR  Rollup error: Could not load /home/max/Projects/<hidden_name_of_project>/.nuxt/dist/server/server.mjs (imported by node_modules/nuxt/dist/core/runtime/nitro/renderer.mjs): ENOENT: no such file or directory, open '/home/max/Projects/<hidden_name_of_project>/.nuxt/dist/server/server.mjs'

 ERROR  Could not load /home/max/Projects/<hidden_name_of_project>/.nuxt/dist/server/server.mjs (imported by node_modules/nuxt/dist/core/runtime/nitro/renderer.mjs): ENOENT: no such file or directory, open '/home/max/Projects/<hidden_name_of_project>/.nuxt/dist/server/server.mjs'

If I run yarn build command again after this error it will succeed. Most interesting thing is: If I delete .nuxt and .output directories after successful build and run yarn build again - build will succeed at first try. However, problem will appear again after deleting node_modules, .nuxt, .output and running yarn install and yarn build again. Also, removing node_modules and not removing .nuxt and .output will not cause the issue.

Additional context

Why is it important?

It breaks build pipelines and force developers to build project twice inside Docker container.

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:8
  • Comments:21 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
geyermichaelcommented, Jul 16, 2022

Getting those error messages after using yarn build as well.

 ERROR  Rollup error: Could not load /Users/michael/Coding/temp/test-nuxt/.nuxt/dist/server/server.mjs (imported by node_modules/nuxt/dist/core/runtime/nitro/renderer.mjs): ENOENT: no such file or directory, open '/Users/michael/Coding/temp/test-nuxt/.nuxt/dist/server/server.mjs'


 ERROR  Could not load /Users/michael/Coding/temp/test-nuxt/.nuxt/dist/server/server.mjs (imported by node_modules/nuxt/dist/core/runtime/nitro/renderer.mjs): ENOENT: no such file or directory, open '/Users/michael/Coding/temp/test-nuxt/.nuxt/dist/server/server.mjs'

I am using PhosphorIcons which works fine in other projects.

But with it, I could reproduce my error messages. Maybe it is helpful to solve this issue.

See https://github.com/geyermichael/nuxt-build-test

PS: First time helping on a github issue. If I missed any further necessary information please let me know. 😃

1reaction
rowanwinscommented, Jul 15, 2022

I’m also experiencing this. Rolling back to nuxt v3.0.0-rc.4 also doesn’t work easily as it seems that many of the nuxt-related dependencies aren’t pinned and so things like nuxi, @nuxt/kit, @nuxt/schema etc are installing v3.0.0-rc.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

@rollup/plugin-node-resolve - npm
Start using @rollup/plugin-node-resolve in your project by running ... This option does not work when a package is using package entrypoints ...
Read more >
Trying Rollup for React Applications | by Nathan Sebhastian
This tutorial will show you how to create a React-Rollup starter app from scratch and how Rollup compares against Webpack in terms of...
Read more >
Compiling React component with rollup is returning webpack ...
Try to replace imported @rollup/node-plugin-resolve from : import resolve from '@rollup/plugin-node-resolve';.
Read more >
How to Create and Publish a React Component Library
rollup -c Failed to load Config... this is because rollup's config cannot support both import statements (esm) and require (cjs) ...
Read more >
How to Setup a TypeScript project using Rollup.js
What is Rollup? In words of the official documentation: Rollup is a module bundler for JavaScript which compiles small pieces of code into ......
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