简体   繁体   中英

Error when `firebase deploy`ing Google Smart Home codelab action

I was trying to follow https://codelabs.developers.google.com/codelabs/smarthome-washer/#2

But I got stuck on firebase deploy on step 3.

First error:

Error: package.json in functions directory has an engines field which is unsupported. The only valid choices are: {"node": "8"} and {"node": "6"}.

After I change the package.json file to use "node":"8", then I get following error:

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

What do I do? Or does someone know any other resources to learn to build a google home action?

I was finally able to deploy when I installed the exactly mentioned dependencies in the package.json.

I changed my package.json from -

{
  "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"
  }
}

to -

{
  "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"
  }
}

changed all the "^2.1.0" to "2.1.0"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM