英文:
Using firebase cli when not installed globally
问题
我正在使用我的工作电脑开发一个类似的项目,没有什么太疯狂的东西,只是在学习一些新的Firebase内容。无论如何,因为这是一台工作电脑,我不能全局安装模块。所以在安装firebase-cli时,我尝试使用推荐的全局命令:
npm install -g firebase-tools
由于这是一台工作电脑,我没有权限,所以这个方法不起作用。所以我为这个项目创建了一个专门的Firebase文件夹,然后在新文件夹中运行了:
npm install firebase-tools
一旦完成,我尝试运行:
firebase -version
但结果是:
firebase: command not found
我以为这会起作用,因为我在我创建并安装Firebase的目录中,但它不起作用。请帮忙!
英文:
I'm using my work computer while developing a sort of side project. Nothing crazy just learning some new firebase stuff. Anyways, because it is a work computer I can't install modules globally. So when it came to installing firebase-cli I tried using the recommended global command:
npm install -g firebase-tools
That didn't work because I don't have permission due to this being a work computer. So I created a firebase folder just for this project and ran
npm install firebase-tools
In the new folder. Once finished I tried running
firebase -version
But this resulted in
firebase: command not found
I thought this would work since I'm in the directory I created and installed firebase in but it doesn't work. Any help please!
答案1
得分: 1
如果您想运行已安装在项目中的包的任何命令,请从项目文件夹中使用 npm exec
。
npm exec -- firebase [CLI 参数]
您尝试运行的版本命令应该如下(请注意标志使用两个破折号):
npm exec -- firebase --version
英文:
If you want to run any command from a package that was installed in a project, use npm exec
from the project folder.
npm exec -- firebase [CLI args]
The version command you were trying to run would go like this (note it's two dashes for the flag)
npm exec -- firebase --version
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论