skyrpex / laravel-nuxt

Build a SPA with Laravel and Nuxt.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

failed to open stream: No such file or directory

iliyaZelenko opened this issue · comments

Hi, package looks good.
When i run laravel-nuxt dev it shows me

[laravel] Laravel development server started: http://127.0.0.1:8001

i opened http://localhost:8000 and saw this error

after i run laravel-nuxt build && laravel-nuxt dev it show me production version and hot-code reloading does not work.

I made it work by replacing the following

Route::get(
    '{uri}',
    '\\'.Pallares\LaravelNuxt\Controllers\NuxtController::class
)->where('uri', '.*');
Route::get('{uri}', function () {
    $source = App::environment('local') ? 'http://localhost:8000/__laravel_nuxt__' : storage_path('app/nuxt/index.html');

    return file_get_contents($source);
})->where('uri', '.*');

Here is my config:

module.exports = laravelNuxt({
  mode: 'spa',

  env: {
    localeDefault: 'ru',
    avatarSizes: {
      lg: 320,
      md: 200,
      sm: 133
    },
    dateFormats: {
      main: 'YYYY-MM-DD'
    },
  },

  router: {
    middleware: 'global'
  },

  /*
  ** Headers of the page
  */
  head: {
    title: 'Заголовок',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: 'Описание' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
      { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' }
    ]
  },
  plugins: [
    { src: '~/plugins/vuetify' },
    { src: '~/plugins/vee-validate' }, // , ssr: false izitoast
    { src: '~/plugins/fontawesome' }, // , ssr: true
    { src: '~/plugins/vue-notifications', ssr: false },
    // { src: '~/plugins/vue-affix', ssr: false },
    { src: '~/plugins/vuex-shared-mutations.js', ssr: false },
    { src: '~/plugins/dayjs.js' },
    { src: '~/plugins/filters.js' }
  ],
  modules: [
    '@nuxtjs/axios',
    '@nuxtjs/auth'
  ],
  css: [
    '~/styles/app.styl'
  ],
  /*
  ** Customize the progress bar color
  */
  // loading: { color: '#3B8070' },
  loading: {
    color: '#1976D2',
    height: '4px'
  },
  /*
   ** Авторизация
   */
  auth: {
    vuex: {
      namespace: 'nuxtAuth'
    },
    strategies: {
      local: {
        endpoints: {
          login: { url: '/api/auth/login', method: 'post', propertyName: 'access_token' },
          logout: { url: '/api/auth/logout', method: 'post' },
          user: { url: '/api/auth/user', method: 'get', propertyName: 'user' }
        }
      }
    },
    redirect: {
      login: '/auth/signin',
      callback: '/auth/signin', // TODO сделать красивую страницу
      logout: '/' // возможно логичней не перенаправлять(false)
    }
  },

  generate: {
    routes: [
      '/auth/socialite/google',
      '/auth/socialite/facebook',
      '/auth/socialite/vkontakte',
      '/auth/socialite/instagram',
      '/auth/socialite/reddit'
    ]
  },

  /*
  ** Build configuration
  */
  build: {
    vendor: [
      'vuetify',
      'vee-validate',
      'vue-izitoast',
      'vue-notifications',
      '@fortawesome/fontawesome',
      'js-cookie'
    ],
    extractCSS: true,
    /*
    ** Run ESLint on save
    */
    extend (config, ctx) {
      if (ctx.isDev && ctx.isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    }
  }
})

Hi there!

By the looks of your screenshot, it seems that the dev server is not on. Could you please try the following and paste here the output?

  • Restore the NuxtController Laravel route.
  • Run laravel-nuxt dev (not build). Paste here the output, please.
  • Open http://localhost:8000/.

Thank you for help! I did everything according to instructions, everything should work.
I followed all steps and got the same error


If i have public/_nuxt files, then laravel-nuxt dev it show me production version and hot-code reloading does not work.
If there is no solution, then I could easily publish my project on the github for you.

Looks like Laravel isn't recognizing that the dev mode is on, but I don't know why. Publishing the project would be helpful, yeah!

Just before that, could you please put your project in a directory without whitespaces? Somewhere like D:\Projects\LaravelNuxtAuthStarter.

https://github.com/iliyaZelenko/laravel-nuxt
Folder name does not affect.
I installed my project from github and everything worked
, but then I did something and again stopped working. Probably because I cached configs in development, I do not remember. Now I'm trying to understand.

I dont now why, i changed some code on github, install project again and get new error after laravel-nuxt dev
error on this line

laravel-nuxt build worked correctly

This issue is solved with your MR, right? skyrpex/laravel-nuxt-js#7

This solved the problem in the last screenshot. But I did not solve the problem because of which I created this question. Try to install my project and run yarn dev, this should give this error.

Although wait, I reinstalled the project and it looks like it works, but it may stop working after something.

Hello again, I was on vacation :)

So is it working then? I'll close the issue for now, feel free to reopen it if needed.