firebase-tools "-bash: firebase: command not found"
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23645220/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
firebase-tools "-bash: firebase: command not found"
提问by cienki
Excited that Firebase's hosting is now out of beta. Trying to get going with with the firebase-tools package and I've successfully installed it:
很高兴 Firebase 的托管现已结束测试。尝试使用 firebase-tools 软件包,我已成功安装它:
npm install -g firebase-tools
Trying to run any tool fails with
尝试运行任何工具失败
-bash: firebase: command not found
I've tried putting the following command in my .bash_profile without any luck
我试过将以下命令放在我的 .bash_profile 中,但没有任何运气
export PATH=/usr/local/share/npm/bin:$PATH
Any ideas? Pretty new to the command line in general.
有任何想法吗?一般来说,命令行相当新。
Thanks!
谢谢!
采纳答案by Flortify
@mklement0 That answer looks good, but I'm worried it will be intimidating to someone who is so new to the command line. So I'm going to cherry-pick the most relevant piece of it.
@mklement0 这个答案看起来不错,但我担心这会让那些不熟悉命令行的人感到害怕。所以我将挑选其中最相关的部分。
@cienki Run this command to see what you should be putting in that PATH
prefix in your .bash_profile
file:
@cienki 运行此命令以查看您应该PATH
在.bash_profile
文件中放入该前缀的内容:
npm get prefix
回答by Durul Dalkanat
Run code below with terminal,
用终端运行下面的代码,
alias firebase="`npm config get prefix`/bin/firebase"
回答by Bruno Peres
You should add the npm bin folder to your bash PATH variable. To do that, run:
您应该将 npm bin 文件夹添加到您的 bash PATH 变量中。为此,请运行:
npm get prefix
And it should output something like /home/your-username/npm-global
.
它应该输出类似/home/your-username/npm-global
.
Then in your ~/.bashrc
or ~/.bash_profile
(if you're in a Mac) file, add:
然后在您的~/.bashrc
or ~/.bash_profile
(如果您使用的是 Mac)文件中,添加:
export PATH="/home/your-username/npm-global/bin:$PATH" # Add npm bin PATH
Note the "/bin" after the npm get prefix
result.
注意npm get prefix
结果后面的“/bin” 。
回答by rsd96
Installing firebase-tools globally did the trick for me :
全局安装 firebase-tools 对我有用:
npm install -g firebase-tools
回答by redderblock
Bruno's answer did the trick, I only needed to add a dot at npm-global in Ubuntu in .bashrc:
布鲁诺的回答成功了,我只需要在 .bashrc 中的 Ubuntu 中的 npm-global 添加一个点:
export PATH="/home/your-username/.npm-global/bin:$PATH" # Add npm bin PATH
回答by RitaSyed
Using Windows 10, Bash
This worked for me:
使用 Windows 10,Bash
这对我有用:
npm get prefix
// to find Path which for me it was C:\Users\User\AppData\Roaming\npm- search "Environment Variables" which located in "System Properties".
- Under "System Variables", find the PATH variable, select it, and click "Edit". Click "New" and add the path found with the "npm get prefix" command earlier (which was for me C:\Users\User\AppData\Roaming\npm) Then click "Ok"
- Restart Bash
npm get prefix
// 找到对我来说是 C:\Users\User\AppData\Roaming\npm 的路径- 搜索位于“系统属性”中的“环境变量”。
- 在“系统变量”下,找到 PATH 变量,选择它,然后单击“编辑”。单击“新建”并添加之前使用“npm get prefix”命令找到的路径(对我来说是 C:\Users\User\AppData\Roaming\npm)然后单击“确定”
- 重启 Bash
firebase --version
//to check firebase version
firebase --version
//检查firebase版本
回答by Robert Fiker
This worked for me on Mac (same thing the others have been posting above, just for Mac):
这在 Mac 上对我有用(其他人在上面发布的内容相同,仅适用于 Mac):
go to your home folder in Finder (named after your user name, in my case "macbook")
press cmd+shift+dot (will reveal hidden files)
go the
.npm-global/bin
folder and copy its path (Finder menu -> View -> Show Path Bar, right click on the bin folder in the path bar -> "Copy 'bin' as Pathname")open Terminal (by default the home folder) and go
nano ~/.bash_profile
at the top of the file add
export PATH="<cmd+v>:$PATH"
(will look similar to this:export PATH="/Users/macbook/.npm-global/bin:$PATH"
)save .bash_profile changes and restart Terminal, firebase command should work now
转到您在 Finder 中的主文件夹(以您的用户名命名,在我的情况下为“macbook”)
按 cmd+shift+dot(将显示隐藏文件)
转到
.npm-global/bin
文件夹并复制其路径(Finder 菜单 -> 查看 -> 显示路径栏,右键单击路径栏中的 bin 文件夹 ->“将‘bin’复制为路径名”)打开终端(默认情况下是主文件夹)然后去
nano ~/.bash_profile
在文件中添加的顶部
export PATH="<cmd+v>:$PATH"
(将类似于此:export PATH="/Users/macbook/.npm-global/bin:$PATH"
)保存 .bash_profile 更改并重新启动终端,firebase 命令现在应该可以工作了
回答by PanAmericano
For anyone using MacOS Catalina 10.15.2getting the bash PATH variable fixed the issue for me.
对于使用MacOS Catalina 10.15.2 的任何人,获取 bash PATH 变量都为我解决了这个问题。
Run:
跑:
npm get prefix
Then run:
然后运行:
export PATH=/Users/userid/.npm-global/bin:$PATH
Note: I recently upgraded from my old High Sierra MacBook Pro, and was confused as well.
注意:我最近从旧的 High Sierra MacBook Pro 升级,也很困惑。
回答by diayn geogiev
For Mac OS Sierra:
对于 Mac OS Sierra:
$ sudo npm install -g firebase-tools
- To stop other Node process use
$ ps aux | grep node
- If needed to upgrade or install emulator -
$ npm install -g @google-cloud/functions-emulator
- Ready to go
$ firebase --version
$ sudo npm install -g firebase-tools
- 停止其他节点进程使用
$ ps aux | grep node
- 如果需要升级或安装模拟器 -
$ npm install -g @google-cloud/functions-emulator
- 准备好出发
$ firebase --version
回答by red
if you installing firebase-tools using
如果您使用安装 firebase-tools
yarn global add firebase-tools
i got same error then i got answer and execute this
我得到了同样的错误然后我得到了答案并执行了这个
export PATH="$(yarn global bin):$PATH"
and then i can do firebase login
pretty well
然后我可以做得firebase login
很好