question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UX: npm 5 error, yarn is not picked

See original GitHub issue

Description

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

  1. 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

  2. Would it be better to check for npm@5 issue before starting to bootstrap the project?

  3. 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.1
  • npm ls react-native: react-native@0.50.3
  • npm ls expo: expo@23.0.6
  • node -v: v8.1.2
  • npm -v: 5.0.3
  • yarn --version: 1.2.0
  • watchman version: watchman: command not found

Also specify:

  1. Operating system: Mac OS X
  2. Phone/emulator/simulator & version: 11

Reproducible Demo

create-react-native-app MyRnApp

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bestandercommented, Jan 25, 2018

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

0reactions
bestandercommented, Jan 25, 2018

Hm weird, yarnpkg binary is in the bin folder https://github.com/yarnpkg/yarn/tree/master/bin

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found