Ionic-cli: No support for yarn package manager (instead of npm)?

Created on 15 Aug 2017  Â·  6Comments  Â·  Source: ionic-team/ionic-cli

_From @IncognitoCore on August 15, 2017 14:41_

Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[x] 3.x

I'm submitting a ... (check one with "x")
[x] bug report
[x] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
When running 'ionic start my-app' it errors on not finding npm and quitting.

    [INFO] Installing dependencies may take several minutes!
    ✖ npm install - failed!
    [ERROR] Command not found: npm

Expected behavior:
Using yarn when npm isn't available and yarn is. OR not crashing but skipping installing packages when no npm installation is detected, and allowing the user to manually install packages via his/her choice of package manager.

Other information:
https://yarnpkg.com/en/

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

cli packages: (/Users/Kevin/.config/yarn/global/node_modules)

    @ionic/cli-utils  : 1.8.1
    ionic (Ionic CLI) : 3.8.1

local packages:

    @ionic/app-scripts : 2.1.3
    Ionic Framework    : ionic-angular 3.6.0

System:

    Node : v7.8.0
    npm  : not installed
    OS   : macOS Sierra

_Copied from original issue: ionic-team/ionic#12668_

Most helpful comment

Perhaps in an addition to:
ionic config set -g yarn true

Now the following, as of my post, is needed for ionic to use yarn:
ionic config set -g npmClient yarn

All 6 comments

_From @AmitMY on August 15, 2017 15:50_

Definitely understandable.
@jgw96 Can you please move this to the ionic-cli repo?

@IncognitoCore This isn't _quite_ documented yet, but please try enabling yarn with:

$ ionic config set -g yarn true

Let me know if you have any issues with it.

Awesome! That works ;) Thanks for the fast response!

ionic config set -g yarn true
[OK] yarn set to true in ../../.ionic/config.json!

@IncognitoCore The Ionic CLI will make use of yarn now instead of npm for package management operations. Do you think it's wise to try to detect yarn and automatically enable it if it exists and npm does not? Did you uninstall npm? 😆 I thought it came with node generally.

@dwieeb I'm not sure actually. I installed yarn via homebrew brew install yarn and it looks like that uninstalled npm.

Perhaps in an addition to:
ionic config set -g yarn true

Now the following, as of my post, is needed for ionic to use yarn:
ionic config set -g npmClient yarn

Was this page helpful?
0 / 5 - 0 ratings

Related issues

patwaswapnil picture patwaswapnil  Â·  3Comments

Tito1337 picture Tito1337  Â·  3Comments

phyr0s picture phyr0s  Â·  3Comments

rashnk picture rashnk  Â·  3Comments

secret4info picture secret4info  Â·  3Comments