Nuxt.js: Nuxt Error: Server resources are not available!

Created on 11 Feb 2019  路  45Comments  路  Source: nuxt/nuxt.js

Version

v2.0.0

Reproduction link

http://im afraid i cant provide a link.

Steps to reproduce

Build the project and copy specified files to separate directory (or a production server) and starting server locally,then an error throw.At the same time ,the local version works fine.

What is expected ?

when i use the cmd npm run start,the project should work fine.

What is actually happening?

but, a nuxt error occured.

This bug report is available on Nuxt community (#c8639)
bug-report

Most helpful comment

For clarification, the improvement is not fixing a known bug. Only better DX and more error info in case of problems.

All 45 comments

@Crazymuyang Do you confirm that you also copy .nuxt dir to production?

@pi0 Yes.I have already configured the parameterbuildDir as 'nuxtdist' in the nuxt config file nuxt.config.js.Actually, it is an old project.When i come back to my company after the Spring Festival and update something to the production env,the project go out.
My English is not very well.Wish you can understand what i want to explain.

@pi0 And I think I have the same issue as that question on Stack Overflow.
Please look here https://stackoverflow.com/questions/54485785/nuxt-deployment-error-server-resources-are-not-available.
Thanks.

@Crazymuyang Thanks for the explanation but honestly without reproduction it is hard to debug. Can you provide somehow source of you project?

I had the same problem.
Step:
1.npm run start
2.Error: Server resources are not available!

I am getting this with nuxt 2.4.3, when running it via express (server.js) as described here https://github.com/pi0/nuxt-plesk-example

@pi0 Yeah. But a bad news. In the last few hours, i have tried to seperate a simple demo from my project. I have installed the dependencies again and again, but the error did not appear any more. That is a very puzzling thing. I am not sure if it will appear again.
@516310460 Have you already solve the problem? And can you reproduce it? Anyway, we need to reproduce the problem. :(

This error happens because @nuxt/vue-renderer can't read production dist (filesystem) from .nuxt/dist/server. Using DEBUG=1 environment variable may help more verbose logs.

when you say "can't read production dist" is this a wrong path issue or something else?

@pi0 It comes again.

[17:55:31] Server listening on http://0.0.0.0:3000
[17:55:32] [NUXT:PROXY] [HPM] Proxy created: /api  ->  https://test.com/
[17:55:32] [NUXT:PROXY] [HPM] Proxy rewrite rule created: "^/api" ~> "/"
[17:55:32] [NUXT:AXIOS] baseURL: http://localhost:3000/
[17:55:32] [NUXT:AXIOS] browserBaseURL: /
[17:55:32] [NUXT:PROXY] [HPM] Proxy created: /api  ->  https://test.com/
[17:55:32] [NUXT:PROXY] [HPM] Proxy rewrite rule created: "^/api" ~> "/"
[17:55:32] Resource not available:
clientManifest
[17:55:32] Resource not available:
modernManifest
[17:55:32] Resource not available:
serverManifest
[17:55:32] Resources loaded:
ssrTemplate,spaTemplate
[17:55:59] Error: Server resources are not available!

For programmatic usage, there should be something wrong in the code. We can help more on this if you can provide a reproduction repository. The error or logs aren't enough.

I'm getting this too - like the others, I can't post a link on here.

Other members of my team on the same project are not getting it with earlier node versions - so I'm wondering if its node version related? I'm on v11.9.0.

It looks to me like a memory leak of some kind - my machine gets slower and slower throughout the day whilst working on the project, until my mac eventually requires a restart

My node is聽v9.10.0, but my setup includes express server...

@pi0 Maybe this can provide some use.
I have tried to upload a simple version of my project to github, but when i cloned it to my pc, the error didnot appear anymore.

I solved the problem when i execution npm install.

I've just run into this bug. Has anyone found a reliable fix?

So building on the server sorted this for me. Building locally then deploying fails.

Seems like clientManifest and serverManifest are (possibly) not created when building locally, for whatever reason...

for-nuxt-error
@angryeuan Yeah.As you can see on the piciture. Reinstall DEPENDENCIES may fix it.

I had this and I've solved it by bumping nuxt from 2.3 to 2.4 and changing npm scripts from nuxt to nuxt-ts binary (because I'm using a TS template).

BTW mind that buildDir option doesn't work and it always build the app into .nuxt directory. 馃挬

@Crazymuyang how come are you still using Windows OS on 2019?

   npm run build
   npm start

if you have some permission problem, use sudo npm run build

Reverting to [email protected] fixed this for me. Thanks everyone

@angryeuan this is no proper way of fixing the issue though 馃檲

@angryeuan this is no proper way of fixing the issue though 馃檲

Correct, but it lets me progress with my work and meet my deadline. I'd imagine others are in a similar situation.

Reverting to [email protected] fixed this for me. Thanks everyone

Same here. If anyone has any advice on how to debug this a little more, it'd be much appreciated. I appreciate it's going to be hard to get this fixed otherwise

@Crazymuyang Are you calling await nuxt.ready() before listening ?

So i'm using https://github.com/nuxt/create-nuxt-app (with express) to scaffold my project and not doing anything particularly fancy with it. Not sure about everyone else?

Hoping to find some time to do some tests on this later in the week. If i can reliably replicate the issues out of the box then i'll post my results here.

@angryeuan Sorry about that, I'll update create-nuxt-app

I'm getting this on yarn dev as well (nuxt)
link is https://github.com/bovas85/nunziellasalluce.com

image

@clarkdo We use create-nuxt-app too.

@bovas85 Could you provide more details that how to reproduce your issue in the repo ?

yep

  • clone repo
  • pull latest master
  • yarn install
  • yarn dev

it will show that error in the console and launch the port showing the image I posted.
After the load is complete the error disappears and I can load the page properly.

No issue in production.

@bovas85 Gocha, about this issue @pi0 is working on a proper fix.

@angryeuan @Crazymuyang create-nuxt-app has been released with the fix.

@angryeuan @Crazymuyang create-nuxt-app has been released with the fix.

Superstar - thanks to all who helped out with this. Very much appreciated.

@clarkdo Thanks a lot. BTW, should I update the version of nuxtjs?

For clarification, the improvement is not fixing a known bug. Only better DX and more error info in case of problems.

I received the same error after running npm start.

npm -v
6.4.1

node -v
v10.15.0

vue -V
3.4.0

Here is my nuxt.config file.

const pkg = require('./package')

module.exports = {
  mode: 'universal',

  /*
  ** Headers of the page
  */
  head: {
    title: pkg.name,
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: pkg.description }
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
  },

  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },

  /*
  ** Global CSS
  */
  css: [],

  /*
  ** Plugins to load before mounting the App
  */
  plugins: [],

  /*
  ** Nuxt.js modules
  */
  modules: ['@nuxtjs/pwa'],

  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {
      // Run ESLint on save
      if (ctx.isDev && ctx.isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    }
  }
}

I tried running npm install again as some suggested but I kept receiving the error.
Somehow I got it working after running npm run build and then trying npm start again.

You may have used git to copy buildDir files
For example, build .nuxt locally, push to the server
So you should open .gitignore
Find dist
Change to # dist or /dist
Because it causes the .nuxt/dist folder to be ignored

That doesn't make sense. Can you explain?

Version:
node: v11.10.0
npm: 6.7.0
nuxt: ^2.4.0

Problem happened:
https://github.com/nuxt/nuxt.js/blob/43709fda1572f37583d2f74b8b62ec379ed07e93/packages/vue-renderer/src/renderer.js#L418

Because of the NODE_ENV equal to production, then the this.context.options.dev is false and the retries is greater than 0. i dont know the detail and what Server resources are not available is. The only thing i guess is something unexpected happened when calculates the retries.

Hope it's helpful.

Same here +1
As @angryeuan said, automation deployment build would fail but build on production server would work.

@kenberkeley you can try to update nuxt to latest version,like v2.4.5 .

@Crazymuyang Upgraded to v2.4.5, same issue

@vanpipy NODE_ENV=production without explicitly setting options.dev means nuxt is starting in production (non-dev) mode, so it is expected that SSR bundle files (Default path: .nuxt/dist/server) exists when starting nuxt.

This problem may be happening because of wrong programmatic usage or bad deployment.

Please create a new issue with a reproducible repo. So we can investigate, help and fix/improve if there are bugs in either nuxt or create-nuxt-app templates.

Error enhancement will be tracked by #5235. -- suggest to follow it to get more details why such error is happening.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

uptownhr picture uptownhr  路  3Comments

VincentLoy picture VincentLoy  路  3Comments

msudgh picture msudgh  路  3Comments

bimohxh picture bimohxh  路  3Comments

lazycrazy picture lazycrazy  路  3Comments