question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot detect workspace root

See original GitHub issue

Environment

  • Operating System: Darwin
  • Node Version: v16.17.1
  • Nuxt Version: 3.0.0-rc.9
  • Nitro Version: 0.5.4
  • Package Manager: unknown
  • Builder: vite
  • User Config: globalName, builder, app, build, modules, postcss, css, components, vite, nitro, hooks
  • Runtime Modules: @vueuse/nuxt@9.3.0, nuxt-jsonld@2.0.6
  • Build Modules: -

Reproduction

Install the latest version and run nuxi generate

Describe the bug

Since the RC version 9 or higher I always get this error when trying to generate a static version of my frontend. Downgrading to RC8 (or below) works as expected.

Additional context

No response

Logs

$ cd /www/frontend
$ nuxi generate
Nuxi 3.0.0-rc.9                                                                                                                                                         10:51:27
Nuxt 3.0.0-rc.9 with Nitro 0.5.4                                                                                                                                        10:51:27

 ERROR  Cannot detect workspace root from /www/frontend                                                                                    10:51:28

  at findWorkspaceDir (node_modules/pkg-types/dist/index.mjs:117:9)
  at async loadOptions (node_modules/nitropack/dist/shared/nitro.9c828268.mjs:2271:26)
  at async createNitro (node_modules/nitropack/dist/shared/nitro.9c828268.mjs:2347:19)
  at async initNitro (node_modules/nuxt/dist/index.mjs:1373:17)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:1559:3)
  at async loadNuxt (node_modules/nuxt/dist/index.mjs:1581:5)
  at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:732:19)
  at async Object.invoke (node_modules/nuxi/dist/chunks/build.mjs:33:18)
  at async Object.invoke (node_modules/nuxi/dist/chunks/generate.mjs:31:5)
  at async _main (node_modules/nuxi/dist/cli.mjs:50:20)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
andresmeidlacommented, Oct 9, 2022

TLDR: a simple git init fixed it for me

in my case the initial npm install failed (project created with npx nuxi init nuxt-app)

looking at the stack trace: pkg-types tries to find the project folder using either:

  • git/config
  • lockifiles (“yarn.lock”, “package-lock.json”, “pnpm-lock.yaml”, “npm-shrinkwrap.json”)
  • or tries to find the path via the supplied parameters I didn’t have git repo initialized nor any lockfiles, so the 3rd option should’ve resolved the path, but it didn’t. findFile("/tmp/nuxt-issue-8014", { startsWith: "/tmp/nuxt-issue-8014" }); will throw an error for some reason 🤷‍♂️

In the case of the test-case repo @ nuxt-issue-8014 copying yarn.lock inside dockerfile will probably solve the issue.

1reaction
danielroecommented, Oct 18, 2022

This should be resolved in the edge channel, or in the next RC.

Let me know if not and I’ll reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

find-workspace-root - npm
Find the root of a multi-package repo with Yarn workspaces. ... Start using find-workspace-root in your project by running `npm i ...
Read more >
why does yarn warn when adding a dependency to the root ...
Since it's assumed that your "root" project won't have it's own "production" dependencies and they should only be in the workspaces.
Read more >
Modify a WorkSpace - AWS Documentation
To see the current modification state of a WorkSpace, select the arrow to show ... WorkSpace root and user volumes come in set...
Read more >
Workspaces in Visual Studio Code
It is possible to leave the folders section of a .code-workspace file empty so that you end up with an instance of VS...
Read more >
Creating and managing workspaces - Perforce
The workspace root, also referred to as client root Closed ... Stream-at-change workspaces are read-only; you cannot check files into a previous changelist....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found