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.

yarn is required to install this library with npm

See original GitHub issue

Bug

Installing this package using npm throws this error:

npm ERR! prepareGitDep sh: yarn: command not found
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! syscall spawn
npm ERR! prepareGitDep npm ERR! file sh
npm ERR! prepareGitDep npm ERR! errno ENOENT
npm ERR! prepareGitDep npm ERR! react-native-device-info@5.4.1 prepare: `yarn build`
npm ERR! prepareGitDep npm ERR! spawn ENOENT
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! Failed at the react-native-device-info@5.4.1 prepare script.

It appears it expects yarn to be installed. If this is expected, it would be helpful if the documentation states as such. However, the docs state you can use either npm or yarn.

Environment info

React native info output:

System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
    Memory: 128.77 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
    Yarn: 1.17.3 - ~/.nvm/versions/node/v10.16.0/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 28.0.2, 28.0.3, 29.0.0
      System Images: android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.3/11C29 - /usr/bin/xcodebuild
  npmPackages:
    react: ^16.9.0 => 16.12.0 
    react-native: ^0.61.5 => 0.61.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native: 0.59.10

Library version: 5.4.1

Steps To Reproduce

  1. Ensure “yarn” is not installed
  2. Run “npm i” on a project depending on this library. …

Describe what you expected to happen:

  1. Installation completes successfully

Reproducible sample code

N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
twelve17commented, Jan 21, 2020

For the record, I was not making a judgement call on yarn vs npm 😀

1reaction
mikehardycommented, Jan 28, 2020

npm is packaged with node whereas yarn is optional, so at least for any path a normal user would take, yes, please PR away. I don’t like mixing dependency managers but I also prefer yarn personally (as do the other maintainers here) so for non-essential (i.e., maintainer-only commands) I think it’s a toss up. Probably should pick one and go with it (which would be npm I suppose. @Johan-dutoit what do you think? I’m inclined to just say “okay, it’s npm now” and move on, feels like it could turn into something like a whitespace debate otherwise, but maybe I’m missing something?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Install and Use the Yarn Package Manager for Node.js
Yarn has a unique way of installing and running itself in your JavaScript projects. First you install the yarn command globally, then you...
Read more >
yarn install
yarn install is used to install all dependencies for a project. This is most commonly used when you have just checked out code...
Read more >
yarn is required to install this library with npm #1359 - GitHub
We recently ran into an issue on a clean install using npm install - full log attached, and relevant excerpt below: 4038 verbose...
Read more >
Yarn vs npm: Everything You Need to Know - SitePoint
To avoid package version mismatches, an exact installed version is pinned down in a package lock file. Every time a module is added,...
Read more >
yarn - npm
Fast: Yarn caches every package it has downloaded, so it never needs to download the same package again. It also does almost everything ......
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