How to use Firebase-tools on Windows?

余生长醉 提交于 2019-12-04 14:21:49

问题


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>

回答1:


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.




回答2:


Firepit is a new CLI tool built for Windows that attempts to be the native firebase-tools

Firepit is a standalone, portable version of the Firebase CLI which has no depedencies (including Node.js). Download, click, and immediately get access to both firebase and npm commands.

Worth checking out https://github.com/abehaskins/firepit



来源:https://stackoverflow.com/questions/28767685/how-to-use-firebase-tools-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!