berry: [Bug?]: Missing install step in docs?
Self-service
- I’d be willing to implement a fix
Describe the bug
I’m trying to install yarn on my new Mac. I am running Node.js 17.5, so the docs (https://yarnpkg.com/getting-started/install) say the only thing I need to do is corepack enable. But yarn install still says zsh: command not found: yarn. I feel like there is another step that is supposed to be in the docs in order to install the yarn command. Or maybe there is a problem with my environment?
To reproduce
corepack enable
yarn install
Environment
macOS 12.2.1, asdf 0.9.0, asdf-nodejs master 50656e5
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 15 (1 by maintainers)
Actually, according to this comment I just found, the solution to this seems to be to run
asdf reshim nodejsafter enabling corepack.btw the trick is to simply restart the shell after
corepack enable- and there’s no reason not to add that to the instructions.Something like “restart/reload your shell to pick up the yarn path”
Yes, there is a step missing from the documentation. After
corepack enable, you need to runcorepack prepare yarn@[version] --activateto actually install Yarn.The steps from @zach-betz-hln kind of worked for me, but I had to choose a specific version so the install for me was:
And it worked after refreshing my terminal (I restarted after each corepack command just to be safe).
@popmonkey - Thank you. This was my issue as well.
For future readers, here’s what I did:
corepack prepare yarn@stable --activatewhich outputPreparing yarn@stable for immediate activation...~/.zshrcin my Terminal, but still got thezsh: command not found: yarnmessageyarn -voutput 3.3.0 👍this should not be closed. i’m on a fresh OS X (12.5) with node 16.14.2 and are running into the exact same issue following the instructions @ https://yarnpkg.com/getting-started/install
i’ve never had yarn 1 installed on this machine. i’ve never even heard of
asdfi’m just following install instructions on the yarn home page. the bug seems to be with the instructions, not some tool i never used.
+1 to add the command raised by @gonfalon - this solved my issue & was nowhere to be seen in the docs.
EDIT:
Surprisingly, I still cannot get the latest version of yarn to work in my environment - here are the commands I run:
Running macOS
12.3.1Just to add information here, if you still get Yarn v1 instead of v3, even after all the above, experiment doing a
yarn set version berry. You can also replace theberrywith a specific version, likeyarn set version 3.4.1.