UX: npm 5 error, yarn is not picked
See original GitHub issueDescription
I could not create a React Native app on my machine and it was not clear why. Apparently it is package manager issues.
create-react-native-app MyRnApp
Creating a new React Native app in /Users/bestander/work/MyRnApp.
Using package manager as npm with npm interface.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN react-redux@5.0.6 requires a peer of react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0 but none was installed.
+ react-native-scripts@1.8.1
added 423 packages in 18.72s
*******************************************************************************
ERROR: npm 5 is not supported yet
*******************************************************************************
It looks like you're using npm 5 which was recently released.
Create React Native App doesn't work with npm 5 yet, unfortunately. We
recommend using npm 4 or yarn until some bugs are resolved.
You can follow the known issues with npm 5 at:
https://github.com/npm/npm/issues/16991
*******************************************************************************
[09:43:27] bestander:~/work $ cat MyRnApp/package.json
{
"name": "MyRnApp",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.8.1"
}
}
Expected Behavior
-
npm@5 problem is printed in yellow (as warning) and I had no idea that I have a corrupt installation with no clear way to recover it. If the error is colored red and there is a guide how to recover (update npm, switch to yarn etc) it would work better for beginners like me
-
Would it be better to check for npm@5 issue before starting to bootstrap the project?
-
I have yarn installed but it was not picked by the app by default I guess because it checks whether yarn is installed using
var result = _crossSpawn2.default.sync('yarnpkg', ['--version'], { stdio: 'ignore' });
Not all Yarn installations register yarnpkg
bin.
Environment
Please run these commands in the project folder and fill in their results:
npm ls react-native-scripts
: react-native-scripts@1.8.1npm ls react-native
: react-native@0.50.3npm ls expo
: expo@23.0.6node -v
: v8.1.2npm -v
: 5.0.3yarn --version
: 1.2.0watchman version
: watchman: command not found
Also specify:
- Operating system: Mac OS X
- Phone/emulator/simulator & version: 11
Reproducible Demo
create-react-native-app MyRnApp
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
React Native Error - yarn' is not recognized - Stack Overflow
I am trying to run a reactnative application. I have updated the npm along with its package ...
Read more >npm vs Yarn | What are the differences? - StackShare
I use npm since new version is pretty fast as well (Yarn may be still faster a bit but the difference isn't huge)....
Read more >@material-ui/core - npm
Start using @material-ui/core in your project by running `npm i ... with npm npm install @material-ui/core // with yarn yarn add ...
Read more >Manage npm packages - Visual Studio (Windows)
Dependency type - Chose between Standard, Development, and Optional packages. · Add to package. · Selected version - Select the version of the ......
Read more >npm, pnpm, and Yarn | IntelliJ IDEA Documentation - JetBrains
Before you start · Download and install Node.js. Note that npm is also installed, so if you are going to use it, you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, looks like this was because my local setup has only
yarn
bin exposed to PATH. I checked brew and install script expose both yarn and yarnpkg.I’ll close the task
Hm weird, yarnpkg binary is in the bin folder https://github.com/yarnpkg/yarn/tree/master/bin