如何在Windows上使用Firebase工具? [英] How to use Firebase-tools on Windows?

查看:612
本文介绍了如何在Windows上使用Firebase工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Windows机器上开始使用Firebase,但我不明白 https://www.firebase.com/docs/web/quickstart.html



我创建了一个带有以下内容的.html文件内容(从该页上的指令复制)。这工作,信息被添加到数据库,并从数据库中检索。但是我迷失在Linux上,就像那个页面上的$ npm install -g firebase-tools这样的指令。

我在 https://www.firebase.com/docs/hosting/quickstart.html



如果我执行上述命令(没有linux $ -prompt)在node.js屏幕上,我得到以下错误信息npm应该在节点repl之外,在你的正常shell中运行。
(按下Control-D退出。)

那么又是什么?

 < html> 
< head>
< script src =https://cdn.firebase.com/js/client/2.2.1/firebase.js>< / script>
< / head>
< body>
< script>
var myFirebaseRef =新的Firebase(https://torrid-inferno-6000.firebaseio.com/);
myFirebaseRef.set({
title:Hello!,
author:Firebase,
location:{
city:旧金山,
state:California,
zip:94103
}
}); (value,function(snapshot){
alert(snapshot.val()); //警报旧金山
(location / city });
< / script>
< / body>
< / html>


解决方案

基本上,我必须打开命令提示符并切换到C :\程序文件\节点,其中文件npm位于),然后npm命令可以按照指示执行。稍后安装firebase时,对PATH环境变量的更改重新启动。之后,可以使用firebase(init,deploy,...)命令来部署站点。

I want to get started with firebase on a Windows machine but I don't understand the getting started instructions on https://www.firebase.com/docs/web/quickstart.html.

I created a .html file with the following content (copied from the instruction on that page). That works, info is added to the database and retrieved from the database. However I'm lost on Linux like instructions like $ npm install -g firebase-tools on that page.

I installed nodejs following the link to nodejs.org on https://www.firebase.com/docs/hosting/quickstart.html

If I execute the above command (without the linux $-prompt) in the node.js screen I get the following error message npm should be run outside of the node repl, in your normal shell. (Press Control-D to exit.)

So then what?

<html>
    <head>
        <script src="https://cdn.firebase.com/js/client/2.2.1/firebase.js"></script>
    </head>
    <body>
    <script>
        var myFirebaseRef = new Firebase("https://torrid-inferno-6000.firebaseio.com/");
        myFirebaseRef.set({
            title: "Hello!",
            author: "Firebase",
            location: {
                city: "San Francisco",
                state: "California",
                zip: 94103
            }
        });
        myFirebaseRef.child("location/city").on("value", function(snapshot) {
            alert(snapshot.val());  // Alerts "San Francisco"
        });
    </script>
    </body>
</html>

解决方案

Basically i had to open command prompt and switch to C:\Program Files\nodejs, where file npm is located), then npm commands can be executed according to instructions. Later on when firebase is installed perform a restart for the changes to PATH environment variable to take effect. After that the firebase (init, deploy, ...) command can be used to deploy a site.

这篇关于如何在Windows上使用Firebase工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆