skyrpex / laravel-nuxt-js

Build a SPA with Laravel and Nuxt.
https://www.npmjs.com/package/laravel-nuxt
MIT License
146 stars 20 forks source link

npm start doesn't generate _nuxt folder #35

Open maverick504 opened 4 years ago

maverick504 commented 4 years ago

I was all day trying to make this package work, but the only way i could make it work was using npm run build and then npm start, obviously that's isn't confortable to work, it should work with npm start and rebuild automatically as i make changes on the code.

Aparently, npm start is detecting changes and all, but is generating all files in the .nuxt folder, not in the _nuxt folder, so i get an error like file_get_contents(/my-project/public/_nuxt/index.html): failed to open stream: No such file or directory.

I've tried with starter projects, like areindl/laravel-nuxt-starter-project and a few others, but i always face the same problem.

I'm not sure if the problem is about nuxt or is that i'm using linux.

Anyone got the same problem?

skyrpex commented 4 years ago

Hi!

In the readme I recommend to alias npm start to laravel-nuxt, which is the same as laravel-nuxt dev. This command runs the following for you: nuxt dev and php artisan serve (it also does some inner wiring so it works out of the box). Basically, after running laravel-nuxt dev it should just work if you open the suggested URL.

nuxt dev doesn't put any files in the _nuxt directory. Instead, it uses generates all the files in memory (because it's much faster). The _nuxt directory is only created after running nuxt build, being the equivalent to larave-nuxt build.

maverick504 commented 4 years ago

Hello again, sorry for the late reply, i went on a trip this weekend and didn't was able to code anything.

I've started a new project and actually followed the readme and it worked!

Previously i was following your tutorial on dev.to, wich gived me problems so i've tried with cloning boilerplates that i've found on GitHub, wich also gived me problems.

Also i've noticed that if i run laravel-nuxt build one time i cannot use laravel-nuxt dev anymore, even deleting node_modules and vendor and reinstalling the packages.

skyrpex commented 4 years ago

Also i've noticed that if i run laravel-nuxt build one time i cannot use laravel-nuxt dev anymore, even deleting node_modules and vendor and reinstalling the packages.

What error do you get when running laravel-nuxt dev after laravel-nuxt build?