Yarn installed nyc successfully, but zsh says "command not found"
Asked Answered
K

1

7

Question: How do I make nyc visible to zsh?

Steps to recreate:

  1. I tried yarn add nyc -g (I was following steps that used npm so I just replaced npm i with yarn add)
  2. Then ran nyc report --reporter=html

zsh: command not found: nyc

  1. However, when I ran npx nyc --help, I got a full list of nyc functions!
  2. Then I tried yarn add -D (from the official nyc documentation)
  3. Then ran nyc report --reporter=text-lcov. Once again:

zsh: command not found: nyc

Karinakarine answered 28/1, 2020 at 19:47 Comment(2)
What directory is nyc installed in? Is that directory on your path?Saeger
@Saeger now that I've installed it globally, it's in /usr/local/bin/nyc, but I don't know where it was before.Karinakarine
K
13

Turns out I didn't install nyc globally. If that's the case for you, you can run nyc by appending npx before any nyc command (which is why npx nyc --help was working).

If you want to install nyc globally with yarn, you have to do: yarn global add nyc

Karinakarine answered 28/1, 2020 at 21:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.