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

[turborepo] fails to parse workspaces from package.json #3207

Closed
enricoangelon opened this issue Jan 8, 2023 · 2 comments · Fixed by #3244
Closed

[turborepo] fails to parse workspaces from package.json #3207

enricoangelon opened this issue Jan 8, 2023 · 2 comments · Fixed by #3244
Assignees
Labels
kind: bug Something isn't working

Comments

@enricoangelon
Copy link

What version of Turborepo are you using?

1.6.3

What package manager are you using / does the bug impact?

npm

What operating system are you using?

Windows

Describe the Bug

When running the build command, I am getting this log from turbo:
WARNING Issues occurred when constructing package graph. Turbo will function, but some features may not be available: 1 error occurred: * json: cannot unmarshal object into Go struct field NpmPackage.packages.workspaces of type []string

That's probably because my workspaces entry is not made of []string but it's formed like that instead:
"workspaces": { "packages": [ "packages/**" ] }

Expected Behavior

Turbo properly parses packages entry.

To Reproduce

Setup a monorepo project using the same "workspaces" entry structure given in the Bug description.

Reproduction Repo

https://github.com/JSPrismarine/JSPrismarine

@enricoangelon enricoangelon added area: turborepo kind: bug Something isn't working labels Jan 8, 2023
@tknickman
Copy link
Member

Hey @HerryYT! Thanks for the report. I took a quick look through how NPM parses workspaces - interestingly, it does look like they allow an Array of strings at either workspaces.packages, or workspaces (source).

Currently we only support:
workspaces: Array<string> and not workspaces: { packages: Array<string> }.

We'll get that fixed up, but to get unblocked in the meantime you can swap your package.json workspace declaration to use the more common (and functionally equivalent):
workspaces: Array<string>.

@tknickman tknickman self-assigned this Jan 10, 2023
tknickman added a commit that referenced this issue Jan 10, 2023
We were unable to parse an npm lockfile that used the alternate format
for workspaces (`"workspaces": { "packages": [ "packages/**" ]}`)

Error manifested as:
```
 WARNING  Issues occurred when constructing package graph. Turbo will function, but some features may not be available:  1 error occurred:
	* json: cannot unmarshal object into Go struct field NpmPackage.packages.workspaces of type []string
```

Fixes #3207 and
#3050
@tknickman
Copy link
Member

@HerryYT parsing error should be fixed in the latest canary and will go out with our next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants