当我尝试部署 Firebase 云功能时,出现以下错误。
\n期望的行为:成功部署功能。
\n错误:
\n\n\n错误:读取functions/package.json时出错:
\nfunctions/lib/index.js 不存在,无法部署\nCloud Functions
\n
完整日志:
\n\n\n …name@name-MacBook-Pro 功能 % firebase 部署
\n=== 正在部署到“newtiktok-21570”...
\n我部署功能运行命令: npm --prefix "$RESOURCE_DIR"\nrun lint
\n函数@ lint /Users/name/Desktop/Yoveo/functions\neslint "src/**/*"
\n/Users/name/Desktop/Yoveo/functions/src/index.ts
\n
\n186:67 警告“timestamp”已定义但从未使用
\n@typescript-eslint/no-unused-vars 377:86 警告“mediaNum”为\ n已定义但从未使用过 @typescript-eslint/no-unused-vars 377:104\n警告“commentText”已定义但从未使用\n@typescript-eslint/no-unused-vars 377:125 警告“commentID”已定义\n但从未使用过 @typescript-eslint/no-unused-vars 419:119\n警告“commentID”已定义但从未使用
\n@typescript-eslint/no-unused-vars 463:121 警告“commentID”已定义但从未使用@typescript-eslint/no-unused-vars 520:75
\n警告“mediaNum”已定义但从未使用
\n@typescript-eslint/no-unused-vars 732:25 警告“slap”已定义但从未使用@typescript -eslint/没有未使用的变量\xe2\x9c\x96 8 个问题(0 个错误,8 个警告)
\n运行命令: npm --prefix "$RESOURCE_DIR" run build \xe2\x9c\x94 功能:\n已完成运行预部署脚本。
\n错误:读取functions/package.json时出错:
\n
我尝试部署fireabase示例,但是当我尝试部署它时,CLI会启动一个错误:
[码]
const functions = require('firebase-functions'); //to activate firebase functions
const admin = require('firebase-admin'); //to active firebase database permissions
admin.initializeApp(functions.config().firebase);
exports.addMessage = functions.https.onRequest((req, res) => {
// [END addMessageTrigger]
// Grab the text parameter.
const original = req.query.text;
// [START adminSdkPush]
// Push the new message into the Realtime Database using the Firebase Admin SDK.
admin.database().ref('/messages').push({original: original}).then(snapshot => {
// Redirect with 303 SEE OTHER to the URL of the pushed object in the Firebase console.
res.redirect(303, snapshot.ref);
});
// …Run Code Online (Sandbox Code Playgroud) javascript firebase eslint google-cloud-functions firebase-cli
当我通过firebase托管我的网页然后写入命令后,firebase deploy我收到以下错误:
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\Users\amarg\Desktop\amar>firebase init
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:
C:\Users\amarg\Desktop\amar
Before we get … 我已经使用 react 和 Google 的 firebaseauth为数据库构建了一个令人惊叹的网络应用程序。在我的本地服务器上,一切运行良好。我可以验证某些用户并在成功登录后导航到下一页。使用 firebase 托管部署我的 Web 应用程序时,问题就开始了。
因此,首先安装firebase-tools然后运行npm run build,然后我初始化了 firebase(我已登录)。然后我跑了firebase deploy。在回答了提示的问题后,我得到了一个指向我所谓的工作站点的URL。
现在,当我使用应该成功登录的详细信息登录时,出现以下错误:
404 Page Not Found 在该网站上找不到指定的文件。请检查 URL 是否有错误,然后重试。为什么我会看到这个?此页面由 Firebase 命令行界面生成。要修改它,请编辑项目配置的公共目录中的 404.html 文件。
要实时查看此错误,请访问以下链接
成功登录后应将用户导航到下一页的部分代码如下所示:
import React, { Component } from 'react';
import fire from './Firebase';
import List from './components/List';
class Login extends Component {
constructor(props) {
super(props);
this.login = this.login.bind(this);
this.handleChange = this.handleChange.bind(this);
this.state = {
email: '',
password: ''
};
}
handleChange(e) { …Run Code Online (Sandbox Code Playgroud)