node.js - `firebase deploy`ing Google Smart Home codelab 操作时出错
问题描述
我试图关注https://codelabs.developers.google.com/codelabs/smarthome-washer/#2
但是我在第 3 步被卡在了firebase deploy上。
第一个错误:
Error: package.json in functions directory has an engines field which is unsupported. The only valid choices are: {"node": "8"} and {"node": "6"}.
将 package.json 文件更改为使用“node”:“8”后,出现以下错误:
Error: Error occurred while parsing your function triggers.
TypeError: Cannot read property 'databaseURL' of undefined
at RepoManager.databaseFromApp (/Users/prafulll/code/personal/direkshanProjects/googleAssistant/smarthome-washer/washer-start/functions/node_modules/@firebase/database/dist/index.node.cjs.js:14985:39)
at Object.instance.INTERNAL.registerService.Reference [as database] (/Users/prafulll/code/personal/direkshanProjects/googleAssistant/smarthome-washer/washer-start/functions/node_modules/@firebase/database/dist/index.node.cjs.js:15526:130)
at FirebaseAppImpl._getService (/Users/prafulll/code/personal/direkshanProjects/googleAssistant/smarthome-washer/washer-start/functions/node_modules/@firebase/app/dist/index.cjs.js:134:66)
at FirebaseAppImpl.(anonymous function) [as database] (/Users/prafulll/code/personal/direkshanProjects/googleAssistant/smarthome-washer/washer-start/functions/node_modules/@firebase/app/dist/index.cjs.js:323:31)
at Object.serviceNamespace [as database] (/Users/prafulll/code/personal/direkshanProjects/googleAssistant/smarthome-washer/washer-start/functions/node_modules/@firebase/app/dist/index.cjs.js:308:32)
at Object.<anonymous> (/Users/prafulll/code/personal/direkshanProjects/googleAssistant/smarthome-washer/washer-start/functions/index.js:28:30)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
Having trouble? Try firebase deploy --help
我该怎么办?或者有人知道任何其他资源来学习构建谷歌主页操作吗?
解决方案
当我在 package.json 中安装了确切提到的依赖项时,我终于能够部署了。
我将 package.json 从 -
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"engines": {
"node": ">=6.11.1"
},
"dependencies": {
"actions-on-google": "^2.1.0",
"cors": "^2.8.4",
"firebase": "^4.0.0",
"firebase-admin": "^5.8.1",
"firebase-functions": "^0.8.1",
"google-auth-library": "^0.10.0",
"googleapis": "^27.0.0"
},
"private": true,
"devDependencies": {
"eslint": "^4.19.1",
"eslint-config-google": "^0.9.1"
}
}
到 -
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"engines": {
"node": ">=6.11.1"
},
"dependencies": {
"actions-on-google": "2.1.0",
"cors": "2.8.4",
"firebase": "4.0.0",
"firebase-admin": "5.8.1",
"firebase-functions": "0.8.1",
"google-auth-library": "0.10.0",
"googleapis": "27.0.0"
},
"private": true,
"devDependencies": {
"eslint": "4.19.1",
"eslint-config-google": "0.9.1"
}
}
将所有“^2.1.0”更改为“2.1.0”
推荐阅读
- java - 有没有办法在没有 RBAC 的情况下获取集群中的所有 pod?
- javascript - Vue Native 的全局样式
- json - Angular 8 - 比较对象内的数组(JSON)的更好方法是什么?
- tsql - 这是处理存储过程中可选参数的好方法吗?
- c - 使用修饰符时的 VT100 数字小键盘转义码(ctrl/shift/alt)
- wordpress - 当我检查页面时,wordpress 库中未显示图像“未找到媒体文件”错误 ID
- excel - 剪切而不是复制时的 PasteSpecial 错误
- sql - SQLRPGLE 无法插入记录 - 尝试将压缩十进制插入整数字段的转换错误
- javascript - JavaScript OnClick 事件的奇怪行为
- c++ - 如何做 C++ 自定义结构化数组下标运算符重载?