Gatsby : -bash: gatsby: command not found after npm install - npm

When I try to install gatsby running npm install gatsby-cli -g , it does not work : when I run gatsby --help, it shows:
bash:gatsby command not found
I have tried:
uninstalling and reinstalling NPM
this gitHub solution : https://github.com/gatsbyjs/gatsby/issues/4967
I get a permission error when trying to change npm config set prefix /usr/local
I'm working on mac (version 10.14.5).
My environment details are as follows:
npm -v : 6.9.0
node -v : v10.16.0
What can I do to make it work?
Thanks in advance,

If it's a permissions error, you could use sudo npm install gatsby-cli -g to run it as a superuser. I have to do this when I install something globally.

Related

How to fix "npm ERR! Unexpected end of JSON input while parsing" on Vue CLI installation

I want to install Vue CLI . and i run this on my Git Bash .
ECLIPSE#DESKTOP-AIUUOKR MINGW64 ~
$ npm install -g #vue/cli
but having error like this :
ECLIPSE#DESKTOP-AIUUOKR MINGW64 ~
$ npm install -g #vue/cli
npm ERR! Unexpected end of JSON input while parsing near '...ery":"latest","throug'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ECLIPSE\AppData\Roaming\npm-cache\_logs\2019-10-09T02_48_52_427Z-debug.log
i try with solution in stackoverflow in this thread here
. i try with
ECLIPSE#DESKTOP-AIUUOKR MINGW64 ~/Desktop
$ npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
but i try to install again , its have same error . someone can help me about this ?
I had a very similar problem and simple npm cache clean --force command did not help too.
I solved the problem by deleting C:\Users\User\AppData\Roaming\npm and C:\Users\User\AppData\Roaming\npm-cache directories and running an npm cache clean --force command after this. Then, npm install worked properly.
If the problem continues to appear, reinstall Node.js and NPM. Do not forget to check if all previous files connected with them are deleted before the installation!
This process work for me
1 - Run your Command Invite/Terminal as Administrator
2 - Install the Vue CLI globally with the command :
npm install -g vue-cli

Why I can't get NPM upgraded?

Here is how I install NPM on a Linux Mint 19.
sudo apt install nodejs
sudo apt install npm
The NPM version I get is 3.5.2, which is not the current version. To upgrade, I try the following commands.
sudo npm install latest-version
which has a few warning messages such as "not such file or directory, open '/home/me/package.json'"
and
sudo mpn install npm#latest -g
which runs without any warning or error messages.
The command
npm -v
still yields 3.5.2.
What is missing?
Also, the reason of using sudo in those upgrade commands is to work around some access permission.
try running:
which npm
and
sudo which npm
I suspect by running sudo apt-get ... you installed npm for your root user as opposed to your current user.
Try this command: npm install -g npm#latest or npm install -g npm#next
You can update NPM with: npm install -g npm.
See this Q&A for more variations that might occur/needed.

Unable to link react-native-version-number

I am trying to install react-native-version-number. The instructions state that after installing, issue;
react-native link react-native-version-number
but when I do this, I get the following error message;
Looks like you installed react-native globally, maybe you meant react-native-cli?
To fix the issue, run:
npm uninstall -g react-native
npm install -g react-native-cli
but when I run
npm uninstall -g react-native
I get
npm WARN uninstall not installed in /usr/local/lib/node_modules: "react-native"
How do I link react-native-version-number?
As a workaround, dv3's comment about using rnpm link did work. However, I found that I was having this problem with other react-native commands, such as react-native run-android. This appears to be because npm was installed using homebrew. A description of this problem and how to fix it can be found at on this gist. In summary the required fix is to uninstall all your npm globably installed packages, uninstall node, then reinstall node, and reinstall npm without brew.
npm list -g --depth=0 # to list all your globally installed packages
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
and then, you have to reinstall all your npm packages that were installed globally.

Typescript npm install not working

When I run sudo npm install -g typescript the only thing that gets installed is test3. This is what I get:
$ sudo npm install -g typescript
Password:
test3#1.0.0 /usr/local/lib/node_modules/test3
$ tsc
-bash: tsc: command not found
The Typescript compiler is never installed. I reinstalled node/npm just now to see if it was an install issue, but that didn't seem to fix it. Any ideas?

Could not install appium using ' npm install -g appium ' command

I have installed node on mavericks using 'brew install node'. Node is installed. But npm version is not shown.
$ node -v
v0.10.26
$ npm -v
-bash: npm: command not found
$ npm install -g appium
-bash: npm: command not found
Please help.
Please try re installing node from the installer package available at http://nodejs.org/
If does not work
try running sudo chmod 777 /usr/local/lib/ from Terminal and reinstall node.js