Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuxt.js After npm run generate cannot find files

I’m trying to generate my app with npm run generate on terminal. I’m not getting some error there is everything well generated. And in my development server everything work well routings components etc., but after generate when I open to index.html in dist folder I can’t access other pages, there are errors like that on chrome console.

Failed to load resource: net::ERR_FILE_NOT_FOUND
f8ff67c7350097487a5e.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
e63cddd635f290d15a6f.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
9a1a3c7742fdcce5403a.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
1e056384fb18617ca6a5.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
bde8656.png:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
/favicon.ico:1 Failed to load resource: net::ERR_FILE_NOT_FOUND

I try to upload dist folder to my ftp but there is too same…

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: [
    // Doc: https://github.com/nuxt-community/axios-module#usage
    '@nuxtjs/axios',
    // Doc:https://github.com/nuxt-community/modules/tree/master/packages/bulma
    '@nuxtjs/bulma',
    // ['nuxt-validate', {
    //   lang: 'tr',
    //   // regular vee-validate options 
    // }]
  ],
  /*
  ** Axios module configuration
  */
  axios: {
    // See https://github.com/nuxt-community/axios-module#options
  },

  /*
  ** Build configuration
  */
  build: {
    postcss: {
      preset: {
        features: {
          customProperties: false
        }
      }
    },
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {

    }
  }
}
like image 598
user3348410 Avatar asked Sep 06 '25 03:09

user3348410


1 Answers

If you access it not via domain root you need to set it in nuxt config https://nuxtjs.org/api/configuration-router/#base

export default {
  router: {
    base: '/app/'
  }
}
like image 129
Aldarund Avatar answered Sep 07 '25 19:09

Aldarund