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: Expected workspace to have one lwc folder #174

Open
lynguyenkhang opened this issue Sep 16, 2024 · 12 comments
Open

Issue: Expected workspace to have one lwc folder #174

lynguyenkhang opened this issue Sep 16, 2024 · 12 comments
Labels

Comments

@lynguyenkhang
Copy link

Summary

After completing the steps in this Preview Components with Local Dev (Beta)
, I run script sf lightning dev app -o MY_SANDBOX. It causes an error

Error (1): Expected workspace to have one lwc folder

And my sfdx project includes the folder force-app/main/default. Please, help me to resolve this issue. Thank you.

Steps To Reproduce:

  1. Complete the steps in this article article,

  2. Run script sf lightning dev app -o MY_SANDBOX

Expected result

The CLI should run successfully.

Actual result

It returns an error

Error (1): Expected workspace to have one lwc folder

Describe what actually happened instead.

Additional information

Feel free to attach a screenshot.

VS Code Version:

SFDX CLI Version:

OS and version:

@albertocabo
Copy link

Same here

@lynguyenkhang
Copy link
Author

Forget to mention that I've been used Code Builder (web-based Visual Studio Code)

@khawkins
Copy link
Collaborator

Thanks for bringing this issue to our attention. A couple of things to note here:

  • Forget to mention that I've been used Code Builder (web-based Visual Studio Code)

    We don't yet support Code Builder for Local Dev, sorry to say. We are investigating how we can support Code Builder use cases in a future release. No timelines yet. #safeharbor

  • That said, this error will also come up in a local VSCode project scenario, when your project does not have the force-app/main/default/lwc/ folder in the local project. We'll look at providing a more descriptive error message guarding against this condition. In the meantime, if you add the force-app/main/default/lwc/ folder to your project, this error should go away—although in this case it's a nominal fix, since without any LWCs in your local project, Local Dev isn't going to do anything for you. You'll want to either retrieve the LWC(s) from your org that you're developing locally, or create a new LWC, deploy it to your org, and then launch Local Dev to see your local changes as you make them.

Let us know if that doesn't describe your setup, and we can work with you to see what else may be going on.

@albertocabo
Copy link

@khawkins in my case I'm working in local VSCode and I do have a force-app/main/default/lwc/ folder

@tparaiso
Copy link

tparaiso commented Oct 4, 2024

I have the same error with multiple folder (the second folder is set at false)
CleanShot 2024-10-04 at 21 04 19

In sfdx-project.json :
CleanShot 2024-10-04 at 21 05 15

I run the command : sf lightning dev app
I get : Error (1): Expected workspace to have one lwc folder

I remove my second folder from sfdx-project.json :
CleanShot 2024-10-04 at 21 06 20
It's Ok Lightning Dev App started.

It's shame that only the default folder at true can't be used.

@khawkins
Copy link
Collaborator

khawkins commented Oct 4, 2024

Sounds like there are a few lingering issues around this part of the functionality. We'll take a look and report back here on options available that you can go forward with. Thanks for the feedback so far!

@grbeazley
Copy link

I'm facing the same issue as @tparaiso where we have multiple package directories in the same SFDX project with LWCs present in more than one of the directories.

Copy link

git2gus bot commented Oct 15, 2024

This issue has been linked to a new work item: W-16985153

@dustinrediess-sikich
Copy link

Same error for me. In my case, however, I have a second package directory configured in sfdx-project.json but it does not contain an LWC folder. Slightly different situation than the example @tparaiso provided.

If I remove that second folder from the packageDirectories list I, too, can run Local Dev successfully.

image

@szymon-halik
Copy link

I am facing the same issue. Support for multi package monorepos is a must

@ravijayaramappa
Copy link
Collaborator

Thanks every one who has reported this issue so far. We are working on a fix and will update here shortly.

@amurashincertinia
Copy link

@ravijayaramappa, is it not too late to extend support for a more flexible directory structure beyond the rigid 4-level dir/dir/dir/lwc?

In some of our projects the directory structure differs from this format.

For example:
force-lib/common/lwc
force-wip/lwc

Projects may also have dependencies listed in the sfdx-project.json:

{
  "packageDirectories": [
    {
      "path": "node_modules/some-other-component-library/force-lib",
      "default": false
    },
    {
      "path": "force-wip",
      "default": false
    },
    {
      "path": "force-lib",
      "default": true
    },
    {
      "path": "force-app",
      "default": false
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants