I'm trying to run a new react native project but I'm getting the same problem over and over:
-bash: react-native: command not found.
I tried to solve the problem trough other post like this: react-native: command not found
But I'm still getting the same error.
I followed all the steps provided by the React Native page (https://facebook.github.io/react-native/docs/getting-started), and I ended up with these info:
1 npm -version 6.4.1
2 brew -version Homebrew 2.1.1
3 brew info watchman stable 4.9.0
4 brew info node stable 12.1.0
5 echo $PATH:
/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/(myname)/Library/Android/sdk/emulator:/Users/(myname)/Library/Android/sdk/tools:/Users/(myname)/Library/Android/sdk/tools/bin:/Users/(myname)/Library/Android/sdk/platform-tools:/Users/(myname)/Library/Android/sdk/tools/bin
if I type in: npm install -g react-native-cli
I get:
/Users/(myname)/.npm-global/bin/react-native -> /Users/(myname)/.npm-global/lib/node_modules/react-native-cli/index.js
+ react-native-cli#2.0.1
updated 1 package in 3.653s
command not found means exactly that - the command you tried to execute (react-native) isn't found in any of the directories listed in your PATH variable.
Figure out where react-native is installed and either call it with a full path to the executable or add the directory to your PATH.
Based on this from your question:
5 echo $PATH:
/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/(myname)/Library/Android/sdk/emulator:/Users/(myname)/Library/Android/sdk/tools:/Users/(myname)/Library/Android/sdk/tools/bin:/Users/(myname)/Library/Android/sdk/platform-tools:/Users/(myname)/Library/Android/sdk/tools/bin
My best guess is that during installation you were following instructions that said to put (myname) somewhere and you literally entered the string (myname) instead of entering your actual login name.
Related
I am setting up a new Mac and trying to install n so that I can manage node versions for my development project. It works great on my old mac but I can't seem to get things sorted on the new Macbook Pro M1.
First, I installed it with npm install -g n and it reported that it installed the package:
npm i n
added 1 package, and audited 2 packages in 1s
found 0 vulnerabilities
But when I use n 10.14.1 to attempt to install a specific version of node, I get this error:
n 10.14.1
zsh: command not found: n
Update: Here is what I get from $PATH in terminal (I switched from zsh to bash so that I could try to match my old Mac's setup):
-bash: /opt/openssl/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/opt/homebrew/bin: No such file or directory
My .bash_profile contents is:
export PATH="${HOMEBREW_PREFIX}/opt/openssl/bin:$PATH"
Update: My npm and corepack folders are located at /usr/local/bin/npm
Everything else I've installed (#angular/cli and n) is being placed in /users/[me]/.npm-global/lib/node_modules/
You should add your .npm-global's bin folder in your $PATH
In your .bashrc or .profile, add:
export PATH=~/.npm-global/bin:$PATH
See point 4 of this doc
I realize this question has been asked a ton, but I feel like I've tried everything. I haven't had any issues with node or npm for months up until now. I am following Airtable Hello World Tutorial. I attached screenshots to save you time. They instruct you to:
Download their npm package with npm install -g #airtable/blocks-cli.
Then run (x's and y's are for authorization.)
block init xxxxxxxxx/yyyyyyyyyyyyy --template=https://github.com/Airtable/blocks-hello-world hello_world
Followed by
cd hello_world
Lastly
block run
This is where the issues start. I get an error that says zsh: command not found: block.
I have tried changing my $PATH variable a few different times
I added source ~/.bash_profile tp ,my ~/.zshrc
I tried adding an alias to my ~/.zshrc
I tried switching to bash and running the commands.
This (StackOverflow) seems to be the same issue but didn't work for me.
Relevant info
npm#6.13.4 /usr/local/lib/node_modules/npm
When I run echo $PATH I get:
/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/{MY_NAME}/npm/bin
When I run which zsh I get:
/usr/local/bin/zsh
When I run which npm I get:
/usr/local/bin/npm
When I run npm list -g | head -n 1 I get:
/Users/{MY_NAME}/.npm-global/lib
I fixed this problem by using nvm to install node. It's much easier to use and I haven't run into these issues anymore.
Here is the link: https://github.com/nvm-sh/nvm
I have installed less using
npm install -g less
and then I installed less-watch-compiler
npm install -g less-watch-compiler
but when I try to run
less-watch-compiler
using less-watch-compiler.config.json file
it tells me that
(command not found)
lessc file.less
tells me the same too
I tried many things but nothing works.
I am using macOS Mojave and npm version is 6.4.1
Problem Solve
I used instructions here to show the hidden folders how to show hidden files in macOS
then I opened the .bash_profile file from /Users/(user) and added this line to the end
PATH="$PATH:$HOME/.npm-global/bin"
export PATH
this added the two commands lessc and less-watch-compiler
I am trying to use the 'firebase' command from my Mac terminal to deploy firebase cloud functions using 'firebase deploy --only functions'. I just used this command a week or two ago when I updated my firebase-functions and firebase-tools to version 3.18.4 but now everytime I try to use the 'firebase' keyword to run a command it says -bash: firebase: command not found. When I run npm -g list I see that I have firebase, firebase-tools and more in that list.
I've tried running 'npm install -g firebase-tools` but it still doesn't work. Also I tried what is recommended in this question
but still not working. Any advice would be great, thanks
First I ran npm get prefix which should output something like /Users/username/.npm-packages. Then I had to add the following to my $PATH variable
export PATH="/Users/username/.npm-packages/bin:$PATH"
Note the extra /bin (after the result of npm get prefix)
And I also added
export PATH="/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:~/bin:$PATH$
Then you must activate the changes to your bash_profile by running source ~/.bash_profile
Once I did this the firebase command is again globally recognized
Try the following in your terminal:
curl -sL https://firebase.tools | bash
This will check the OS of your machine and then install everything else automatically and properly.
The command is from the official Firebase Documentation.
I've just fallen into the same issue. My case was in different node versions a) when installing firebase globally, b) when using it during next session. I'm using nvm and my default was node v10, but I installed firebase on node v12. So after restart I got node v10. When I realised it, I switched nvm default from v10 to v12:
$ nvm alias default v12.13.1
And firebase started working.
For those who use yarn instead of npm to manage global packages, yarn seems to place binaries in isolated directory as symbolic links.
In my case, I did yarn bin to look for where binaries are, turned out it is $HOME/.config/yarn/global/node_modules/.bin. So, I set it to .bashrc. Now it's working.
I seem to not be able to get away from oh_my_zsh, which is causing errors.
When I run npm install, I am getting the error: zsh: command
not found: npm.
When I check which version of node I am running, I get zsh: command
not found: node. Node is definitely installed.
I tried uninstalling oh_my_zsh using uninstall_oh_my_zsh and
trying npm install again. I again get the error zsh: command not found: npm.
I tried uninstalling oh_my_zsh with Homebrew. I got the error zsh: command not
found: brew.
I tried restarting Terminal, and visually verified oh_my_zsh is not installed. I still get these errors.
I tried reinstalling oh_my_zsh, using sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)". Still get zsh: command not found: node
I don't have a problem with oh_my_zsh (or homebrew); I actually like it. I used to have a work around. I have not installed anything recently.
eta: In addition to this, I've tried updating homebrew, thinking that there was some issue with Homebrew. But ultimately error when I using Homebrew is
Error: /usr/local/opt/pkg-config not present or broken. Please reinstall pkg-config.
Apparently Homebrew was able to update Auto-updated Homebrew! and then started to clean up packages and started to upgrade node.
I got the following Caveats and then the error.
This formula is keg-only, which means it was not symlinked into /usr/local,
macOS provides libicucore.dylib (but nothing else).
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/icu4c/lib
CPPFLAGS: -I/usr/local/opt/icu4c/include
==> Summary
🍺 /usr/local/Cellar/icu4c/60.2: 249 files, 68.2MB, built in 6 minutes 47 seconds
==> Installing node
Error: /usr/local/opt/pkg-config not present or broken
Please reinstall pkg-config. Sorry :(
Solution: Apparently node wasn't installed or not installed correctly. I used the package installer from nodejs.org, not the Homebrew installation, to install node. npm install, node -v work as they should. I do get warnings when I run brew doctor, including mentions of node headers, but I will ignore them until something stops working again.