At the request of @gaearon:
https://yarnpkg.com/en/docs/cli/global
The official Yarn documentation states that you can install (and maintain) your create-react-app project with yarn. However, it doesn't actually work. Calling create-react-app
after a global yarn install does nothing. CRA currently only works from a global npm install.
It would be great if yarn and CRA went together like chocolate and peanut butter.
Works for me:
gaearon@gaearon-mbp ~> yarn global add create-react-app
Using globally installed version of Yarn
yarn global v0.17.8
warning No license field
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Installed [email protected] with binaries:
- create-react-app
warning No license field
✨ Done in 2.99s.
gaearon@gaearon-mbp ~> create-react-app ~/p/hmmm
Creating a new React app in /Users/gaearon/p/hmmm.
Installing packages. This might take a couple minutes.
Installing react-scripts from npm...
Can you specify more details?
I installed yarn using npm. How did you install yarn?
I installed node using nvm. I'm using node 4.5.
On Wed, 30 Nov 2016 at 23:24 Dan Abramov notifications@github.com wrote:
Works for me:
gaearon@gaearon-mbp ~> yarn global add create-react-app
Using globally installed version of Yarn
yarn global v0.17.8
warning No license field
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Installed [email protected] with binaries:
- create-react-app
warning No license field
✨ Done in 2.99s.
gaearon@gaearon-mbp ~> create-react-app ~/p/hmmm
Creating a new React app in /Users/gaearon/p/hmmm.Installing packages. This might take a couple minutes.
Installing react-scripts from npm...Can you specify more details?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/facebookincubator/create-react-app/issues/1118#issuecomment-263885555,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJ5zNVlUQbPEgCcSuaDn8EuVA-8kvV3ks5rDYcQgaJpZM4K_zbg
.
I'm using a FB laptop so it's preinstalled here. I'll try again at home.
I was able to repro this...
Initial setup:
[email protected] (installed via npm)
[email protected] (installed via nvm)
Switched to node 4 via nvm, yarn global add create-react-app
, and got:
-bash: create-react-app: command not found
@stevensacks this at all similar to your situation? If you do a global remove, then global add, does it work?
Likely related to https://github.com/yarnpkg/yarn/issues/1151#issuecomment-255452232?
perhaps try installing with brew, as per this guide?
Installing via brew is strongly recommended against.
On Thu, 1 Dec 2016 at 9:34 Dan Minshew notifications@github.com wrote:
perhaps try installing with brew, as per this guide
https://yarnpkg.com/en/docs/install?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebookincubator/create-react-app/issues/1118#issuecomment-264042633,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJ5zLQXAHhoJusgEDzhc1EqboLcNXccks5rDhYMgaJpZM4K_zbg
.
Maybe I can't reproduce because I'm using n instead of nvm.
Will need to try with nvm.
@stevensacks why would be not recommended to use brew?
I can reproduce this as well. Installed Yarn via npm and node via npm. Also doesn't work for node installed via brew.
Likely https://github.com/yarnpkg/yarn/issues/1151, we need to wait for this to be fixed on Yarn side.
I'm already tracking all Yarn issues in https://github.com/facebookincubator/create-react-app/issues/1189 so I'll close this one as it's unactionable for us.
This solved it for me (on Ubuntu 16.04)
export PATH=$PATH:~/.yarn/bin
Hi, so this looks like a chain of crappy bugs cluster-munging together... For me I think it's the result of using NVM and Yarn together which might be confusing Yarn a little.
I deleted my yarn (I'm on Ubuntu on this laptop) and reinstalled using "don't give me extra things"
sudo apt-get remove yarn
sudo apt-get install --no-install-recommends yarn
Then found that yarn global bin
is /usr/local/bin
but the actual location is ~/.config/yarn/global/node_modules/.bin
or something.
Yarn may not fix this for NVM anytime soon but this NPM utility shortcuts the manual file linking:
https://www.npmjs.com/package/fix-yarn-global-packages
(not my tool, just just found it looking around)
I then tested location using which create-react-app
which gave me /usr/local/bin/create-react-app
, finally!
This:
yarn create react-app <name> --scripts-version reason-scripts
then worked and chugged away happily building the app.
Most helpful comment
This solved it for me (on Ubuntu 16.04)
export PATH=$PATH:~/.yarn/bin