Gatsby: Installing gatsby-cli with yarn does not work

Created on 14 Sep 2018  路  13Comments  路  Source: gatsbyjs/gatsby

yarn global add gatsby-cli

The above command does not work. I have to use npm (npm install -g gatsby-cli) to make it work. Not sure if this issue is consistent across systems.

Summary

Relevant information

Environment (if relevant)

System Details:

System:
OS: Linux 4.4 Ubuntu 16.04.1 LTS (Xenial Xerus)
CPU: x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
Shell: 4.3.46 - /bin/bash
Binaries:
Node: 8.11.4 - ~/.nvm/versions/node/v8.11.4/bin/node
Yarn: 1.9.4 - /usr/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v8.11.4/bin/npm
npmGlobalPackages:
gatsby-cli: 1.1.58

File contents (if changed)

gatsby-config.js: N/A
package.json: N/A
gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

question or discussion

Most helpful comment

Have you added yarn's global dir to your PATH? yarn global bin will list the directory, you should export it in your .bashrc, e.g.: export PATH=$PATH:~/.yarn/bin

All 13 comments

Have you added yarn's global dir to your PATH? yarn global bin will list the directory, you should export it in your .bashrc, e.g.: export PATH=$PATH:~/.yarn/bin

Hi @palerdot, any updates on the suggestions provided by @stefanprobst?

@kakadiadarpan @stefanprobst For now, I have already installed with npm. Maybe, I will update in this thread after trying uninstalling existing and reinstalling with yarn.

Sure. For now, we'll be closing this. Please reopen if you still face this issue.

@stefanprobst @kakadiadarpan adding yarn bin to path works. This should be mentioned somewhere in the docs, just in case.

"The above command does not work" is not enough for search.

Could you add the error message for this command?

adding yarn bin to path works. This should be mentioned somewhere in the docs, just in case.

This is a known issue with Yarn and not directly related to Gatsby.

"The above command does not work" is not enough for search.

Could you add the error message for this command?

Well, with me what happens is

warning "gatsby-cli > [email protected]" has unmet peer dependency "@types/react@>=16.8.0".
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - gatsby
Done in 3.65s.

Facing this issue as well!
Here's my output:

arn global v1.22.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - gatsby
Done in 3.43s.

Please check your PATH variable. See also https://github.com/gatsbyjs/gatsby/issues/8138#issuecomment-421248540

Forgot to check that, Fixed My issue! Thanks!

@ri2parna
What was your issue exactly and how you solved it?

This was the issue I've been facing
The packages seem to get installed but didn't show up when i try to run the terminal :
The terminal gave an output that said : command not found

yarn global v1.22.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - gatsby
Done in 3.43s.

I forgot to add the yarn path to my $PATH, so i found out the directory which is why the installed packages were not showing in my terminal. I found the yarn directory to be added to the path by using yarn global bin and then i added it to the path using the command as stated in
https://github.com/gatsbyjs/gatsby/issues/8138#issuecomment-421248540 and added to my bashrc file ( in my case it was the .zshrc file) and it solved my problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandonmp picture brandonmp  路  3Comments

ghost picture ghost  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments

rossPatton picture rossPatton  路  3Comments

timbrandin picture timbrandin  路  3Comments