Skip to content
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

Issue with isMonorepo Option in a Next.js + Turbo Repo + Yarn Workspaces Setup #1824

Open
jonathandion opened this issue Dec 11, 2024 Discussed in #1822 · 0 comments
Open
Assignees
Milestone

Comments

@jonathandion
Copy link
Contributor

Discussed in #1822

Originally posted by jonathandion December 10, 2024
Hi,

I’m encountering an issue while using the isMonorepo option. Here’s my setup:
• Frameworks/Tools: Next.js with Turbo Repo and Yarn workspaces.
• Workspace Structure (defined in the root package.json):

package.json using workspaces:

{
  "workspaces": [
    "packages/*",
    "apps/*"
  ]
}

I created a new ReNative project using npx rnv new outside my mono repo and copied the generated project in my apps folder.

Following the project creation, I updated the renative.json configuration in the new project with:

{
  "isMonorepo": true
}

However, when I try to run a command (e.g., rnv run), I encounter the following error:

This project is marked as part of monorepo and it has no custom install tasks. Run your usual monorepo bootstrap procedure and re-run command again.
error: ⨯  Cancelled

What I Need Help With

  1. Could you provide an example or detailed steps on how to properly set up ReNative in a monorepo environment like Turbo repo?
  2. Where exactly should I execute the npx rnv new command? Should it be inside a specific folder, like apps/, or somewhere else?
  3. What does ReNative mean by “custom install tasks”? Are there additional steps or configurations required beyond enabling "isMonorepo": true in renative.json?
  4. Do I need to have my renative.json at the root of my mono repo?

Update 1: When using Yarn Workspaces, everything works as expected but I'm not using it the isMonoRepo flag . However, when integrating with Turbo Repo, I encounter the following error:

info: Current engine: @rnv/engine-core (../../../.npm-packages/lib/node_modules/rnv/node_modules/@rnv/engine-core/lib)
task: ○ new ↺1
? What's your project Name? (folder will be created) hello-renative
? What workspace to use? rnv
? What template to use? @rnv/template-starter - Multiplatform 'hello world' template
✔ Executing: npm view @rnv/template-starter versions
✔ Executing: npm dist-tag ls @rnv/template-starter
? What @rnv/template-starter version to use? 1.7.0 (@latest)
✖ FAILED: yarn add @rnv/[email protected] --dev
error: ⨯  COMMAND:

yarn add @rnv/[email protected] --dev

FAILED with ERROR:

error An unexpected error occurred: "Cannot read properties of undefined (reading 'manifest')".
info If you think this is a bug, please open a bug report with the information provided in "/Users/jondion/code/my-turborepo/apps/hello-renative/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Error: Command failed with exit code 1: yarn add @rnv/[email protected] --dev
warning package.json: No license field
warning Missing version in workspace at "/Users/jondion/code/my-turborepo/apps/hello-renative", ignoring.
error An unexpected error occurred: "Cannot read properties of undefined (reading 'manifest')".
yarn add v1.22.19
info No lockfile found.
info If you think this is a bug, please open a bug report with the information provided in "/Users/jondion/code/my-turborepo/apps/hello-renative/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
    at makeError (/Users/jondion/.npm-packages/lib/node_modules/rnv/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/jondion/.npm-packages/lib/node_modules/rnv/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

yarn add v1.22.19
warning package.json: No license field
info No lockfile found.
warning Missing version in workspace at "/Users/jondion/code/my-turborepo/apps/hello-renative", ignoring.
error An unexpected error occurred: "Cannot read properties of undefined (reading 'manifest')".
info If you think this is a bug, please open a bug report with the information provided in "/Users/jondion/code/my-turborepo/apps/hello-renative/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Update 2: I was able to bypass the error above, but now I'm facing an error when running npx rnv build -p web

Error: <Html> should not be imported outside of pages/_document.
Read more: https://nextjs.org/docs/messages/no-document-import-in-page
 at Q (/Users/jondion/code/pfu-qub-web/apps/demo-tv/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js:16:5430)
 at W (/Users/jondion/code/pfu-qub-web/apps/demo-tv/platformBuilds/app_web/output/server/chunks/943.js:6:388)
 at Wc (/Users/jondion/code/pfu-qub-web/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
 at Zc (/Users/jondion/code/pfu-qub-web/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
Error occurred prerendering page "/500". Read more: https://nextjs.org/docs/messages/prerender-error
Error: <Html> should not be imported outside of pages/_document.
Read more: https://nextjs.org/docs/messages/no-document-import-in-page
```</div>
@Marius456 Marius456 added this to the 1.10 milestone Dec 16, 2024
@Marius456 Marius456 self-assigned this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants