【发布时间】:2019-06-02 17:21:32
【问题描述】:
我刚刚使用 ReactJS 创建了一个电子商务网站,并使用 Firebase 作为我的数据库和托管。我部署了该站点,它加载到我的电脑上,但没有加载到我的移动设备或我朋友的电脑上。我不确定问题是什么。我也尝试重新部署该站点,但仍然没有运气。我最近以这种方式部署了另一个项目,没有任何问题。我在下面包含了来自我的终端的所有信息。任何建议将不胜感激。
Bens-MacBook-Pro:velo-e-commerce benharned$ sudo npm install -g firebase-tools
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
+ firebase-tools@6.2.2
updated 1 package in 3.074s
Bens-MacBook-Pro:velo-e-commerce ######$ firebase login
Already logged in as #######76@gmail.com
Bens-MacBook-Pro:velo-e-commerce #######$ firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
/Users/#######/Documents/velo-e-commerce
Before we get started, keep in mind:
* You are initializing in an existing Firebase project directory
? Which Firebase CLI features do you want to setup for this folder? Press Space
to select features, then Enter to confirm your choices. Hosting: Configure and d
eploy Firebase Hosting sites
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
i .firebaserc already has a default project, skipping
=== Hosting Setup
Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.
? What do you want to use as your public directory? build
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? File build/index.html already exists. Overwrite? No
i Skipping write of build/index.html
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
✔ Firebase initialization complete!
Bens-MacBook-Pro:velo-e-commerce benharned$ firebase deploy
=== Deploying to 'velo-velo'...
i deploying functions, hosting
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (42.44 KB) for uploading
✔ functions: functions folder uploaded successfully
i hosting[velo-velo]: beginning deploy...
i hosting[velo-velo]: found 19 files in build
✔ hosting[velo-velo]: file upload complete
i functions: updating Node.js 6 function charge(us-central1)...
✔ functions[charge(us-central1)]: Successful update operation.
i hosting[velo-velo]: finalizing version...
✔ hosting[velo-velo]: version finalized
i hosting[velo-velo]: releasing new version...
✔ hosting[velo-velo]: release complete
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/velo-velo/overview
Hosting URL: https://velo-velo.firebaseapp.com
Bens-MacBook-Pro:velo-e-commerce benharned$
【问题讨论】:
-
这信息太少了。检查生产站点时是否有错误日志,构建系统是否按预期运行(即将相关工件复制到“公共目录”)或其他内容。如果您详细说明构建/部署脚本,也会有所帮助。
-
刚刚编辑了帖子并从终端添加了信息。
-
当我尝试在手机上打开网站时,我只是得到一个白屏,没有任何错误或任何东西。
-
如果我检查 your page 的 JavaScript 控制台,我会看到大量错误消息。你可能想检查一下。要获得有关导致错误的实际代码的更具体帮助,请查看:how to create a minimal, complete, verifiable example。
-
这是我在检查页面时看到的:imgur.com/a/C0TiZff 到目前为止,我最好的猜测是您的构建系统存在问题。 react教程指导我们做一件事。 firebase 教程指导我们做另一个。你需要在中间组装一些东西。这不是您需要的确切解决方案,而是一个好的开始。此示例 repo 可能会帮助您组装一个足以用于开发和生产的构建过程:github.com/sombriks/react-browserify-firebase
标签: reactjs firebase stripe-payments