whythawk / full-stack-fastapi-postgresql

Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Nuxt3, Docker, automatic HTTPS and more.
MIT License
231 stars 47 forks source link

Front end won't start because nuxt not found #9

Closed dividor closed 1 year ago

dividor commented 1 year ago

Hi There,

First, thanks SO much for this repo, it's a huge help!

The backend starts nicely, but the frontend container fails with the following ...

**docker logs my-app-frontend-1**
yarn run v1.22.19
$ nuxt dev
/bin/sh: 1: nuxt: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I saw no errors with the docker build and start.

Thanks!

turukawa commented 1 year ago

Hey @dividor I've had this problem as well and I think it's purely for the dev environment. This never worked well with the Vue/Nuxt frontend on the original fullstack because it doesn't do hot reload, even though it used to start. Now, for some reason, it doesn't reference the nuxt dev command correctly (something to do with the path), which may have something to do with errors in nuxt itself ... still a very new release with a few glitches.

For development, what I do is simply run the frontend directly (i.e. outside of docker). I've got that in the readme.

NOTE: I find that the Nuxt container does not run well in development mode, and does not refresh on changes. In particular, nuxt/content is very unpredictable in dev mode running in the container. It is far better to run the frontend outside of the container to take advantage of live refresh.

Change into the /frontend folder, and:

yarn install yarn dev

Just note that you'll use http://localhost:3000 and not http://localhost to reach it, although the api will still be at the backend http://localhost/api/v1.

I find it more responsive to work this way, otherwise you're messing around with starting and stopping your docker containers to get the updates you need on Nuxt.

dividor commented 1 year ago

Thanks for the workaround @turukawa!