firebase CLI将无法识别"firebase init"的当前目录 [英] firebase CLI will not recognize current directory for 'firebase init'
问题描述
我正在关注有关Ionic Angular的教程,并且到了讲师要我将代码发布到Firebase Hosting的地步.首先,我使用NPM安装Firebase CLI.然后指示我使用firebase init
命令.问题是CLI似乎无法识别在我的终端中选择的当前目录.
I am following a tutorial on Ionic Angular and it has come to the point where the instructor is having me publish my code to Firebase Hosting. First I used NPM to install the Firebase CLI. Then I was instructed to use the firebase init
command. The issue is that the CLI doesn't seem to recognize the current directory that is selected in my terminal.
我运行:cd /Users/MyUserName/myProjectsFolder/myProject/
然后我运行firebase init
,它显示:
I run: cd /Users/MyUserName/myProjectsFolder/myProject/
Then I run firebase init
and it displays:
您将在此目录中初始化Firebase项目:
You're about to initialize a Firebase project in this directory:
/Users/MyUserName
/Users/MyUserName
我希望它读为:
您将在此目录中初始化Firebase项目:
You're about to initialize a Firebase project in this directory:
/Users/MyUserName/myProjectsFolder/myProject
/Users/MyUserName/myProjectsFolder/myProject
一些谷歌搜索发现了此页面: https://firebase.google.com/docs/cli/
A little bit of googling found this page: https://firebase.google.com/docs/cli/
其中包括以下段落:
要初始化新的项目目录,请将终端中的目录更改为所需的项目目录,然后运行:firebase init
To initialize a new project directory, change directories in the terminal to your desired project directory and run: firebase init
基于此,我希望可以采取一些步骤.
Based on this I would expect the steps I took to work.
我很困惑.有没有人遇到过这种行为?谁能想到一种使CLI正常运行的方法?
I am confused. Has anyone ever run into this behavior? Can anyone think of a way to get the CLI to function as expected?
谢谢.
推荐答案
-
转到文件夹:
Got to folder:
/Users/Username/
/Users/Username/
搜索名称为firebase.json的文件并将其删除.
Search for a file with name of firebase.json and Delete it.
使用此命令重新安装firebase工具(--unsafeper-以避免 权限错误消息&使用sudo):
Reinstall firebase tool with this command (--unsafeper- to avoid permissions error messages & use sudo):
$ sudo npm install --unsafeper- -g firebase-tools
$ sudo npm install --unsafeper- -g firebase-tools
然后,转到您的pubilc文件夹(必须创建一个),该文件夹 包含您的HTML,JS,图像和CSS文件,并使用以下命令:
Then, go to your pubilc folder (you have to create one) which contains your HTML, JS, images and CSS files and use this command:
$ sudo firebase初始化
$ sudo firebase init
$ sudo firebase deploy
$ sudo firebase deploy
重置很容易,如firebase中所述 docs:
The reset is easy and as mentioned in the firebase docs:
https://firebase.google.com/docs/hosting/quickstart
这篇关于firebase CLI将无法识别"firebase init"的当前目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!