繁体   English   中英

Nuxt.js在npm运行后生成无法找到文件

[英]Nuxt.js After npm run generate cannot find files

我正在尝试在终端上使用npm run generate生成我的应用程序。 我没有收到任何错误,所有内容均已生成。 而且在我的开发服务器中,所有工作都能很好地路由组件等,但是在生成后,当我打开dist文件夹中的index.html时,我无法访问其他页面,因此在chrome控制台上会出现类似错误。

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

我尝试将dist文件夹上传到我的ftp中,但是太相同了……

这是我的nuxt.config文件

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) {

    }
  }
}

如果您不是通过域根目录访问它,则需要在nuxt config https://nuxtjs.org/api/configuration-router/#base中进行设置

export default {
  router: {
    base: '/app/'
  }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM