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

[Docs] yarn berry installation #40933

Closed
2 tasks done
fulldecent opened this issue Oct 10, 2024 · 8 comments
Closed
2 tasks done

[Docs] yarn berry installation #40933

fulldecent opened this issue Oct 10, 2024 · 8 comments

Comments

@fulldecent
Copy link
Contributor

fulldecent commented Oct 10, 2024

Prerequisites

Proposal

The install documentation explains how to set up with yarn.

Please also explain how to set up with yarn berry.

Motivation and context

This setup is non-trivial. I am several days into learning the difference between sass/sass-loader and how to make it work with Yarn Berry.

Good documentation here might help many people.

Also

That page links to https://github.com/twbs/bootstrap-npm-starter which is archived and it references Node SASS which is also archived.

Perhaps this further illustrates how non-trivial this is.

@robin-ostertag
Copy link

+1

@mdo
Copy link
Member

mdo commented Nov 15, 2024

Near as I can tell, Yarn's berry repo is just... Yarn?

See https://getbootstrap.com/docs/5.3/getting-started/download/#yarn for latest docs, and https://github.com/twbs/examples/tree/main/sass-js for more updated examples.

@mdo mdo closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2024
@fulldecent
Copy link
Contributor Author

Here is what happens when you follow those instructions:

➡️ ~/Desktop
git clone https://github.com/twbs/examples.git

➡️ ~/Desktop
cd examples/sass-js/

➡️ ~/Desktop/examples/sass-js main
nvm install --lts && nvm use --lts

➡️ ~/Desktop/examples/sass-js main 8s
corepack enable     

➡️ ~/Desktop/examples/sass-js main
yarn set version stable

➡️ ~/Desktop/examples/sass-js main*
git diff | cat   
diff --git a/package.json b/package.json
index 3cde257..b5e6273 100644
--- a/package.json
+++ b/package.json
@@ -4,5 +4,6 @@
   "version": "0.0.0",
   "private": true,
   "repository": "twbs/examples",
-  "license": "MIT"
+  "license": "MIT",
+  "packageManager": "[email protected]"
 }

➡️ ~/Desktop/examples/sass-js main*
yarn                                      

Usage Error: The nearest package directory (/Users/williamentriken/Desktop/examples/sass-js) doesn't seem to be part of the project declared in /Users/williamentriken/Desktop/examples.

- If /Users/williamentriken/Desktop/examples isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If /Users/williamentriken/Desktop/examples is intended to be a project, it might be that you forgot to list sass-js in its workspace configuration.
- Finally, if /Users/williamentriken/Desktop/examples is fine and you intend sass-js to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.

$ yarn install [--json] [--immutable] [--immutable-cache] [--refresh-lockfile] [--check-cache] [--check-resolutions] [--inline-builds] [--mode #0]

@julien-deramond
Copy link
Member

Here is what happens when you follow those instructions:

Just tried it real quick, I haven't got any issues by doing the following:

git clone https://github.com/twbs/examples.git
cd examples
yarn install
yarn start

It created automatically a yarn.lock (as it's supposed to, instead of the package-lock.json), and launched the server at localhost:4200.

Am I missing something here?

@fulldecent
Copy link
Contributor Author

@julien-deramond can you please do yarn --version? You may be running Yarn v1 which is the old one which is not Yarn Berry.

@julien-deramond
Copy link
Member

julien-deramond commented Nov 17, 2024

My bad, I thought I had the latest version, I had by default the v1. Thanks @fulldecent for pointing it out.
So in order to make it work:

  1. git clone https://github.com/twbs/examples.git, then cd examples/sass-js
  2. Configure yarn to continue using node_modules
yarn config set nodeLinker node-modules

This will create a .yarnrc.yml containing nodeLinker: node-modules.

  1. Then, create an empty yarn.lock

  2. yarn install

  3. yarn start

If we modify this section of the documentation to mention that, would it be OK? I mean, without using Yarn Plug'n'Play

@fulldecent
Copy link
Contributor Author

Thank you, this is super helpful, I really appreciate it.

These are magic little lines of code that can be really hard to find so it is great to see them together.

Perhaps when we update the documentation, we can put this as yarn Berry, but then also keep the old yarn 1.X below it.

@julien-deramond
Copy link
Member

FYI, I've created #41036 just to mention this "trick" to compile our examples with Yarn Berry in the documentation. It's probably better than nothing already, :) let's continue the discussion in the PR if needed.

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

No branches or pull requests

4 participants