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

[Bug]: While trying to build or dev, the error is spawned: "Nuxtr: no package manager found" #82

Closed
Hibryda opened this issue Nov 7, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@Hibryda
Copy link

Hibryda commented Nov 7, 2023

Environment

Nuxt project info: 7:02:57 AM


  • Operating System: Linux
  • Node Version: v20.8.0
  • Nuxt Version: 3.8.0
  • CLI Version: 3.9.1
  • Nitro Version: 2.7.2
  • Package Manager: yarn@4.0.0
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

What went wrong?

While trying to run dev, build or any other run option, the error pops up with contents as in the title and no further details.

Important to note - the default package manager Nuxtr is set to Yarn, yet the error appeared even without this setting set.
Also, the repo is a monorepo with tree of subdirs.
The default package manager of the subrepo is Yarn.

When running Nuxtr on a solitary Nuxt repo, with npm acting as a package manager, everything works fine.

How to reproduce it?

Build a repo similar to described.
Like:

repo_root
-> apps
---> app1
---> app2

Use Yarn as the package manager.

@Hibryda Hibryda added the bug Something isn't working label Nov 7, 2023
@adhamfarrag
Copy link
Member

Hello @Hibryda

Speficing package manager will just save you the step of choosing which one, it still has to verify if package.json exists or not, and in this case, do you have a package.json in your root dir ?

Currently Nuxtr doesn't support multi project in a monorepo. Working on this and will be available soon.
The only use case currently supported is when you're having a single FE app in your monorepo and all what you just need to do is adding this line to .vscode/settings.json in your monorepo root dir.

  "nuxtr.monorepoMode.DirectoryName": "apps/app1"

@Hibryda
Copy link
Author

Hibryda commented Nov 7, 2023

Hello @adhamfarrag,

I have package.json in both the root dir and in the app dirs. I also added the monorepo key you mentioned, specifying the subdir of the app. Otherwise, Nuxtr would not run at all.
I'm glad to hear that you're working on the issue. Maybe separate config dotfiles would help here? It's quite a common practice. Or a custom entry in package.json? Then, multiple projects could be recognized in monorepo.

One last question - how do you think, long would it take to solve this matter? I can live with using terminal, yet Nuxtr proved being useful.

@adhamfarrag
Copy link
Member

Hi @Hibryda So, the issue for you was missing monorepo configuration that I mentioned ? Just wanting to make sure I understood properly.

I'm currently focusing on refactoring the project so I can implement monorepo / sub-repos use cases. But my ultimate goal here is auto detection so users have one less configuration to worry about.

Another way to do is is reintroducing the same configuration but as an array where users can add multiple apps.

@adhamfarrag
Copy link
Member

Glad you find Nuxtr useful, my goal here is to empower Nuxt with the best DX for VSCode and more IDEs soon and won't hesitate to implement any feature to make it better and easier to use.

For a workaround, I suggest you either use VSCode multiple windows and keyboard shortcuts to navigate between windows.

Using Where am I by Anthony Fu is great to help with detecting where you are and navigating easier.

@Hibryda
Copy link
Author

Hibryda commented Nov 8, 2023

@adhamfarrag No, the issue wasn't in the monorepo setting - I found and set it before posting here. The error remained the same. I only pointed out that without the monorepo value set, the project is not recognized by Nuxtr at all (when starting from the monorepo root level.

I understand your focus on autodetection, though addition of minimal config won't hurt. Alternatively, parsing workspaces entry in monorepo's package.json could be a way - visiting all end nodes indicated (directly or via glob). The specs for this entry are already quite solid and adopted.
Array config would work, yet they would require updates when dirs are changed (as, as far as I understood, the array config would sit in subconfig in VS Code). Optional configs in project dirs would allow for autodetection by the plugin and would work irrespectively to where the project sits on the disk.

As to the workflow, at the moment I'm forcing specific windows into specific workspaces (OS workspaces - Linux) and it works just fine. A bit of muscle memory plus key shortcuts complete the work pattern.
Yet, will try the nav helper you suggested. Thank you.

@adhamfarrag
Copy link
Member

Duplicate of #49

@adhamfarrag adhamfarrag marked this as a duplicate of #49 Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants