Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuxt deployment error: server resources are not available

To deploy our nuxt website in ssr mode we first build and unit test website in the bitbucket pipeline and if tests are green we copy build files from bitbucket servers to our production server and trigger start.

The problem is that Nuxt documentation says nothing about which exact files are required on the server.

currently we are using:

.nuxt/  
server/  
static/  
nuxt.config.js 

Sometimes after adding functionality to the website, deployed version throws an error:

Error: Server resources are not available!

At the same time local version works fine.
Also running production server locally on the project works. Error kinda hints that some paths picked up incorrectly by nuxt.. but the directory structure is completely the same.

Any ideas why this happens and how to fix that?

like image 465
31415926 Avatar asked Feb 01 '19 19:02

31415926


People also ask

What server does Nuxt use?

Nuxt 3 is powered by a new server engine, Nitro. Cross-platform support for Node. js, Browsers, service-workers and more. Serverless support out-of-the-box.

Is Nuxt 3 ready for production?

Nuxt 3 is in release candidate stage and available as the nuxt@rc npm tag. The latest updates on Nuxt 2. x are available via the nuxt-edge npm package and are expected to be released soon for forward compatibility.

Is Nuxt faster than Vue?

Nuxt offers better SEO improvement with its server-side rendering feature, faster development with auto-generic router, public share features and management with great configuration options and meta tags methods, automatic code splitting with pre-rendered pages – all of this is impossible or extremely complex to ...


2 Answers

If errors also mentions, Please check "file path"/.nuxt/dist/server existence. Then on the terminal

cd .nuxt

check if 'dist' folder exists. If it does not exists,

go back and npm run build. this will generate the 'dist' folder for use.

If Still facing the issue, try,

npm install --save nuxt
npm install --save vue-server-renderer
like image 200
lokanath Avatar answered Oct 10 '22 19:10

lokanath


Try adding: dev: process.env.NODE_ENV === 'DEV' to nuxt.config.js

like image 43
Dorian Tudorache Avatar answered Oct 10 '22 20:10

Dorian Tudorache