-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Getting "Workspaces can only be enabled in private projects" even for a private project #8580
Comments
I'm seeing this warning in a public project that does not use workspaces. |
Could you provide a minimal package.json to reproduce the issue? |
Possible duplicate of: webpack/webpack-cli#479 |
In package.json add the directory in workspace like
|
In my case, the issue is indeed caused by a dep that has Seems like yarn should either tell you the offending package, or just not warn at all if a dep erroneously has |
I am having this same warning in a project that does not use workspaces upon |
At this point it shouldn't warn about this in dependencies at all. The dependencies might be using a package manager that uses that field differently. For example, in yarn v2 using workspaces in a published package is perfectly fine:
-- https://yarnpkg.com/features/workspaces#how-to-declare-a-worktree For us, we get the warning since we have |
See also reduxjs/react-redux#1815 |
So, do you mean that it's likely a false positive? I'm new to workspaces and my current project uses them with Yarn Classic. But I question whether they have been set up correctly due to other problems I found. I can't determine if this warning arises from something I did, or the existing project itself. It actually displays 3 times
|
NPM says hello and a friendly "up yours" to the only-private-packages-have-workspaces rule 👋 |
its gotten worse on node v18
build is now blocked these institutions are in over their head and the frustration is a group failure altogether mismanaged hopefully microsoft will fix everything |
@rally25rs @merceyz Here is a minimal reproduction package.json of the issue (just installing {
"name": "yarn-warning-repro",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"dependencies": {
"semantic-release": "^19.0.3"
}
} yarn version 1.22.19 A repository of the reproduction: https://github.com/gduliscouet-ubitransport/yarn-warning-repro |
thanks for the repro case @gduliscouet-ubitransport It looks like one of the transitive deps is
The
which is what is leading to this warning. Since this is just a warning I think it can be ignored; the |
Thank you @rally25rs for analysing this, 1. This "workspaces should be private" rule is a standard for package managers. They should all warn (or error) if the project (or one of its dependencies) is breaking the rule. In this case I'll open an issue on the npm repo and any other repo breaking the rule and we can close this one. 2. The rule is not standard, only yarn is applying it. In this case yarn should not warn for dependencies breaking the rule since they may use another package manager. I agree that it is only a warning and it can be ignored, but some warnings need to be addressed and this one is just creating noise. It is encouraging devs to ignore every warnings, making warnings useless |
This warning is typically for the a third party dependency or dependency of a dependency getting installed. It's not likely useful for developer running the install. This is made extra confusing by not showing the name of the module the warning is for. My opinion is that this warning should only be displayed when publishing if a published package has The only time it should be shown at install time is if this problem is with one of the packages in the workspace. And if that's the case, it should say which package that is. |
In my case, I was trying |
The piece of code throwing the warning Lines 873 to 876 in 3119382
|
Is there any update on this issue? I'm experiencing this issue in my public repo: https://github.com/nkowaokwu/igbo_api/actions/runs/4455179532/jobs/7824826839?pr=576 |
NOTE: getting this warning: > warning Workspaces can only be enabled in private projects. > warning Workspaces can only be enabled in private projects. > warning Workspaces can only be enabled in private projects. > warning Workspaces can only be enabled in private projects. - yarnpkg/yarn#8580
Is it not possible to inform the developer which project is actually offending? i.e. the workspace project that does not have |
I guess no hope for this? |
It's related to the built-in @npmcli dependencies using workspaces. I have been debugging the other side of the issue from the npm side. I had to switch to yarn just to work around things. NPM CLI is broken on windows for Node 16.14+ because of NPM. Then I saw all of these warnings pop up related to workspaces when running yarn. |
We are in the process of converting from NPM to Yarn, because NPM nohoist options suck, and we ran into this. What is the logic behind restricting workspaces to only private projects? |
After 1.5yrs of this ticket being open, this comment above seems the only option 😓 |
Yarn classic / v1 has not been in active feature development for a couple years. Major version 4 is close to being released. While it is an admittedly confusing message, Seeing a warning does not prevent anyone from continuing to use yarn.
I didn't write that feature initially, but I believe the thought behind "workspaces" was that they are a collection of deploy-able npm packages (each package in the workspace would be I'm going to mark this issue as
I'd also like to take this moment to encourage folks to upgrade to yarn modern where possible. |
This is useless and unproductive. Of course a warning can be ignored, but if a warning is not providing any actionable information whatsoever (you would agree that a yarn user using I would consider this a bug in yarn v1.
Not actually true. The mentioned Keep in mind this problem doesn't just affect users of |
This bug should be re-opened and fixed, it is an issue in Yarn v1, since it is still the default, even when initializing a new project. This is actively causing issues for users of |
Why is there no reaction if this is obviously a bug? I use workspaces in my project and can't turn them off in |
Also think this still a bug that should be fixed |
this is not even a warning it is throwing an error for me and preventing the project from being installed. is there a way to completely bypass this? |
Here is the solution to this issue (not a workaround). The issue should stay closed because it is solved. tl;dr You are running and old version of Yarn. And when you think you are upgrading it you are not. Root causeYou are running an old version of Yarn. And when you think you are upgrading Yarn, you are not. Proof: yarn --version Compare to actual current Yarn releases. Things that don't work ❌Don't do these things. Intuitively they look like they will work but actually they do nothing.
SolutionUninstall Yarn on your system if you installed it using any non-preferred (even retroactively non-preferred) ways. brew uninstall yarn Then install the preferred way. (Here is how I prefer, there are others.) brew install nvm
nvm install --lts --reinstall-packages-from=current # If you don't use that second flag you get old version
nvm use --lts Then install yarn corepack enable # You already have this command installed when you installed Node.js Then delete your .lock file which may be preventing upgrades rm yarn.lock Now you can use yarn yarn install
yarn set version stable # This will update your package.json to add a $.packageManager entry Notice how everything looks different? You are on the new version now. And the warning is gone. Follow on workPlease feel free to ignore any of this. Good vibes only. Here's how I think the world can be a better place:
|
@fulldecent this issue is not about yarn berry, its about yarn v1. Please see the above discussion. |
Yarn Berry, the Node Another alternative is switching to pnpm, which just keeps delivering on the original promise of Yarn 1.x; a faster more stable NPM. None of these package managers are perfect. PNPM has its own issues just like yarn 1.x, but it's actively maintained, and this particular warning does not happen. |
It's also not just brew, if v1 really should not be installed then it shouldn't be the default in the distros package managers. Right now
If they really want people to upgrade to v4 then it shouldn't be so painfully hard to do so Instead yarn v4 has to be installed on top of v1 for any project that you run, it cannot be installed globally AFAIK Yarn berry is in a completely different project so the releases are not tracked in this one and that's probably because it's now a completely different package manager So yeah do yourself a favor and switch back to |
I'm using yarn + lerna in a mono-repo, and today, after rebuilding my lockfile, I started seeing this warning from yarn:
I'm not sure why I'm seeing this because I have this in my package.json:
Seems like a bug in yarn?
Node 14.15.0
yarn 1.22.5
lerna 3.22.1
The text was updated successfully, but these errors were encountered: