火力地堡初始化错误。 (节点:82729)UnhandledPromiseRejectionWarning
firebase init error. (node:82729) UnhandledPromiseRejectionWarning
当我在我的 React 应用程序上初始化 firebase 时,
我通过一些 firebase 询问后出现主题错误。
详情如下。
What language would you like to use to write Cloud Functions? (Use arrow keys)
❯ JavaScript
TypeScript (node:82729) UnhandledPromiseRejectionWarning: Error
at new FirebaseError (/usr/local/lib/node_modules/firebase-tools/lib/error.js:9:18)
at module.exports (/usr/local/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)
at Request._callback (/usr/local/lib/node_modules/firebase-tools/lib/api.js:39:35)
at Request.self.callback (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)
at Request.emit (events.js:315:20)
at Request.EventEmitter.emit (domain.js:483:12)
at Request.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1161:10)
at Request.emit (events.js:315:20)
at Request.EventEmitter.emit (domain.js:483:12)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1083:12)
(node:82729) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:82729) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我以前创建一些react app的时候没有出现过这样的错误。但是,我得到了这个错误 today.I 我想我会在我的 node.js 上得到这个错误。但我不知道如何修复 node.js .
我是 node.js 和 firebase 的初学者。
我该如何解决这个错误?
我试图修复我在 Internet 上找到的一些解决方案。正在关注
我确实从 v10.12.3 重新安装了 node.js v12.18.3。另外,我在 mac 上重新安装了 firebase-tools。我试图在 firebase init 之前在我的 React 应用程序上重新安装 firebase。
此外,我忽略了这个错误,然后完成了 firebase 的初始化。但是当我部署 firebase 时,我做不到。相反,我在命令行上遇到了这个错误。
Error: HTTP Error: 404, Method not found.
现在,我无法解决这个错误。
如果您有任何想法,请帮助和建议我。
感谢阅读!
06/ 09 / 2020 添加了我的 firebase.json 并作出反应 package.json。
这里是 firebase.json
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
},
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
这里是package.json
{
"name": "react-bot",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"firebase": "^7.19.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
已经安装的包。
firebase-tools@8.10.0
firebase@7.19.1
node.js v12.18.3
macOS10.15.6
错误图片
如果我这样做了 firebase deploy
,我会收到此错误。
我试图用 %RESOURCE_DIR% 替换“$RESOURCE_DIR”。我得到了不同的错误。
先更新firebase-tools:
npm install -g firebase-tools
看到你的截图后,我在部署函数时看到了错误。
尝试将 firebase.json
文件中的 $RESOURCE_DIR 替换为 %RESOURCE_DIR%。
多平台解决方案
Linux
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
PowerShell
"predeploy": [
"npm --prefix $Env:RESOURCE_DIR run lint"
]
Cmd.exe
"predeploy": [
"npm --prefix %RESOURCE_DIR% run lint"
]
前面的讨论在下面Github Issue。请看一下。
当我在我的 React 应用程序上初始化 firebase 时, 我通过一些 firebase 询问后出现主题错误。
详情如下。
What language would you like to use to write Cloud Functions? (Use arrow keys)
❯ JavaScript
TypeScript (node:82729) UnhandledPromiseRejectionWarning: Error
at new FirebaseError (/usr/local/lib/node_modules/firebase-tools/lib/error.js:9:18)
at module.exports (/usr/local/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)
at Request._callback (/usr/local/lib/node_modules/firebase-tools/lib/api.js:39:35)
at Request.self.callback (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:185:22)
at Request.emit (events.js:315:20)
at Request.EventEmitter.emit (domain.js:483:12)
at Request.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1161:10)
at Request.emit (events.js:315:20)
at Request.EventEmitter.emit (domain.js:483:12)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1083:12)
(node:82729) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:82729) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我以前创建一些react app的时候没有出现过这样的错误。但是,我得到了这个错误 today.I 我想我会在我的 node.js 上得到这个错误。但我不知道如何修复 node.js .
我是 node.js 和 firebase 的初学者。 我该如何解决这个错误?
我试图修复我在 Internet 上找到的一些解决方案。正在关注
我确实从 v10.12.3 重新安装了 node.js v12.18.3。另外,我在 mac 上重新安装了 firebase-tools。我试图在 firebase init 之前在我的 React 应用程序上重新安装 firebase。
此外,我忽略了这个错误,然后完成了 firebase 的初始化。但是当我部署 firebase 时,我做不到。相反,我在命令行上遇到了这个错误。
Error: HTTP Error: 404, Method not found.
现在,我无法解决这个错误。 如果您有任何想法,请帮助和建议我。 感谢阅读!
06/ 09 / 2020 添加了我的 firebase.json 并作出反应 package.json。 这里是 firebase.json
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
},
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
这里是package.json
{
"name": "react-bot",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"firebase": "^7.19.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
已经安装的包。
firebase-tools@8.10.0
firebase@7.19.1
node.js v12.18.3
macOS10.15.6
错误图片
如果我这样做了 firebase deploy
,我会收到此错误。
我试图用 %RESOURCE_DIR% 替换“$RESOURCE_DIR”。我得到了不同的错误。
先更新firebase-tools:
npm install -g firebase-tools
看到你的截图后,我在部署函数时看到了错误。
尝试将 firebase.json
文件中的 $RESOURCE_DIR 替换为 %RESOURCE_DIR%。
多平台解决方案
Linux
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
PowerShell
"predeploy": [
"npm --prefix $Env:RESOURCE_DIR run lint"
]
Cmd.exe
"predeploy": [
"npm --prefix %RESOURCE_DIR% run lint"
]
前面的讨论在下面Github Issue。请看一下。