-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to deploy with Nuxt 3 layers in a monorepo #395
Comments
Thank you for your feedback and clear explanations @serhii-chernenko 🙏 To fix the "postinstall": "npm run dev:prepare --workspace src/layers/*", This will make sure the I just fixed the In you GitHub Action, you can remove the - - name: Build app
- run: npm run build
-
- name: Deploy with nuxthub
- working-directory: ./src/apps/app
- run: npx nuxthub deploy --no-build
+ run: npx nuxthub deploy src/apps/app
env:
NUXT_HUB_PROJECT_KEY: ${{ secrets.NUXT_HUB_PROJECT_KEY }}
NUXT_HUB_USER_TOKEN: ${{ secrets.NUXT_HUB_USER_TOKEN }} If you don't want to use the GitHub action and use Cloudflare Pages CI, then:
Note You should either use the GitHub action OR the Cloudflare Pages CI. I hope my answer helps 🙏 Feel free if you have any questions or suggestions! |
Hi @atinux, Related commits: I added {
"scripts": {
"postinstall": "npm run dev:prepare --workspace src/layers/*"
}
} Moreover:
Additionally, I added {
"optionalDependencies": {
"nuxthub": "^0.7.6"
}
} To be sure, I have the right version as you also mentioned. But as a result I got error:
I guess because I decided to restore
and keep
But got
Did I miss something? |
@atinux it was my bad, sorry. Also, I decided to check, if it works the same with disabled GitHub Actions workflow and could be deployed with CloudFlare Pages deployments. The deployment was successfully done BTW, but the domains were not accessible for unknown reasons. But when I disabled autodeployment in CF and restored GitHub Actions workflow, pages are alive. Maybe some specific configuration in CF has to be done anymore!? |
Explanation of NuxtHub deployment issue within a monorepo project
Repo: https://github.com/serhii-chernenko/nuxthub-issue/
Content
Architecture
I expect a monorepo for complex project where I expect different Nuxt 3 apps that extends shared Nuxt 3 layers within one repository to speed up development and make easier a codebase management.
A structure is already prepared within the current repository but there are some expectations:
Prepare local environment
Project workspaces
In the root
package.json
file I have workspaces setup:In the UI layer's
package.json
the package named@demo/ui
:In the App
package.json
the package fakely installed with a file reference:The layer package is extended in
layers
ofnuxt.config.ts
of theapp
application:Remove
node_modules
from any nested directoriesBefore starting development I have to remove any nested
node_modules
andpackage-json.lock
files:Local development
When I want to start the application I go to the root directory where I have the
package.json
with thedev
script:and run the command
When the app is started, everything works perfectly:
Prepare deployment environment
When everything is prepared for development, I want to build my application via NuxtHub service.
NuxtHub
Currently I have one NuxtHub project especially for the demo issue explanation:
It's a reference to the domain: https://nuxthub-issue.nuxt.dev/.
GitHub Actions and secrets
Regarding the documentation, I have to have 2 ENV variables such as
NUXT_HUB_PROJECT_KEY
andNUXT_HUB_PROJECT_DEPLOY_TOKEN
.NUXT_HUB_PROJECT_KEY
is provided there: https://admin.hub.nuxt.com/serhii-chernenko/nuxthub-issue/settings/environmentAnd
NUXT_HUB_PROJECT_DEPLOY_TOKEN
is available there:Then I added both secrets to github actions config: https://github.com/serhii-chernenko/nuxthub-issue/settings/secrets/actions
Issues
However, I got a couple of issues here.
Initial deployment
Initial deployment was successfully finished somehow but as a result, I see just a "clear" Nuxt 3 application and it's not the same as I have locally:
https://nuxthub-issue.nuxt.dev/
GitHub actions build failed
When I set up everything correctly, I have deployment errors:
https://github.com/serhii-chernenko/nuxthub-issue/actions/runs/12338464409/job/34433433401
Local deployment
So, if GitHub actions are not working, I tried to repeat it locally.
I prepared the
.env
file in the root directory and in the app directory just to be sure that it has to work in any cases:When I run the command from the root project directory
I got the error:
So, I tried to run it from the app dir:
I got the error:
It's expected because I expect workspaces here not to run anything inside nested apps, I want to make it working from the root project directory.
I also tried to change the application directory, but it didn't help:
Expected help
I want a clear explanation and detailed instructions how to make my current setup working. Please, don't suggest me to move layers to different repositories to extend them as external modules. I want exactly the setup what I described.
But decision of choosing NuxtHub make me mad at this point, because I spent 1 day and I totally failed.
The text was updated successfully, but these errors were encountered: