[英]Using firebase cli when not installed globally
I'm using my work computer while developing a sort of side project.我在开发一种副项目时正在使用我的工作计算机。 Nothing crazy just learning some new firebase stuff.
学习一些新的 firebase 东西没什么疯狂的。 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:
因此,在安装 firebase-cli 时,我尝试使用推荐的全局命令:
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
所以我为这个项目创建了一个 firebase 文件夹并运行
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.我认为这会起作用,因为我在我创建并安装 firebase 的目录中,但它不起作用。 Any help please!
请帮忙!
If you want to run any command from a package that was installed in a project, use npm exec
from the project folder.如果要从安装在项目中的 package 运行任何命令,请使用项目文件夹中的
npm exec
。
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)您尝试运行的版本命令将像这样 go (请注意,标志是两个破折号)
npm exec -- firebase --version
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.