gatsby --version > -bash: gatsby: command not found
you have to update your config. You may have to follow few steps
Set Config
remove existing config
npm config delete prefix
set new config
npm config set prefix /usr/local
Install gatsby
npm i -g gatsby-cli
now check version
gatsby --version
Instead of trying to install globally, you can use npx
npx gatsby new my_dir_name
Then run:
npx gatsby develop
Then:
npx gatsby build
And then you can run them using
npm run develop npm run build