конфликты версий эмулятора функций firebase - PullRequest
0 голосов
/ 30 июня 2018

Я работаю на macOS High Sierra, версия 10.13.5.

Когда я пытаюсь запустить функции локально с узлом v6.11.5, появляется эта ошибка:

⚠ функции: не удается запустить эмулятор. Пожалуйста, используйте версию Node v6.9.1, у вас v6.11.5

Затем, когда я переключаюсь на версию v6.9.1, используя nvm,

nvm use 6.9.1
rm -rf node_modules
npm install
npm uninstall firebase-tools --global
npm install firebase-tools --global
functions stop
npm uninstall -g @google-cloud/functions-emulator
npm install -g @google-cloud/functions-emulator
firebase login
firebase serve --only functions --debug

, тогда эта ошибка появляется:

Для запуска эмулятора требуется Node.js версии 6.11.5 или выше!

⚠ функции: ошибка эмулятора. Ошибка: эмулятор упал! Проверьте файл журнала ...

Вот полный журнал:

[2018-06-30T15:43:38.960Z] ----------------------------------------------------------------------
[2018-06-30T15:43:38.964Z] Command:       /Users/duyanh/.nvm/versions/node/v6.9.1/bin/node /Users/duyanh/.nvm/versions/node/v6.9.1/bin/firebase serve --only functions --debug
[2018-06-30T15:43:38.965Z] CLI Version:   3.19.1
[2018-06-30T15:43:38.965Z] Platform:      darwin
[2018-06-30T15:43:38.965Z] Node Version:  v6.9.1
[2018-06-30T15:43:38.966Z] Time:          Sat Jun 30 2018 10:43:38 GMT-0500 (CDT)
[2018-06-30T15:43:38.966Z] ----------------------------------------------------------------------

[2018-06-30T15:43:38.978Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2018-06-30T15:43:38.979Z] > authorizing via signed-in user
[2018-06-30T15:43:38.981Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/dewey-nguyen

 Sat Jun 30 2018 10:43:38 GMT-0500 (CDT)
[2018-06-30T15:43:39.348Z] <<< HTTP RESPONSE 200 server=nginx, date=Sat, 30 Jun 2018 15:43:39 GMT, content-type=application/json; charset=utf-8, content-length=111, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-06-30T15:43:39.350Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/dewey-nguyen/tokens

 Sat Jun 30 2018 10:43:39 GMT-0500 (CDT)
[2018-06-30T15:43:39.953Z] <<< HTTP RESPONSE 200 server=nginx, date=Sat, 30 Jun 2018 15:43:39 GMT, content-type=application/json; charset=utf-8, content-length=260, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-06-30T15:43:39.955Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/dewey-nguyen

 Sat Jun 30 2018 10:43:39 GMT-0500 (CDT)
[2018-06-30T15:43:40.183Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sat, 30 Jun 2018 15:43:40 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="43,42,41,39,35", accept-ranges=none, connection=close

=== Serving from '/Users/duyanh/workspace/dewey-nguyen'...

i  functions: Preparing to emulate functions.
[2018-06-30T15:43:40.736Z] Fetching environment
[2018-06-30T15:43:40.739Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/580895528558:getServerAppConfig

 Sat Jun 30 2018 10:43:40 GMT-0500 (CDT)
[2018-06-30T15:43:41.167Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sat, 30 Jun 2018 15:43:41 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="43,42,41,39,35", accept-ranges=none, connection=close
[2018-06-30T15:43:41.168Z] Starting @google-cloud/functions-emulator
Node.js v6.11.5 or greater is required to run the Emulator!
⚠  functions: Error from emulator. Error: Emulator crashed! Check the log file...
[2018-06-30T15:43:41.256Z] Error: Emulator crashed! Check the log file...
    at ChildProcess.child.on (/Users/duyanh/.nvm/versions/node/v6.9.1/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator/src/cli/controller.js:650:24)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

Это мой package.json:

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    ...
  },
  "dependencies": {
    "@google-cloud/vision": "^0.20.0",
    "actions-on-google": "^2.2.0",
    "bluebird": "^3.5.1",
    "colors": "^1.3.0",
    "dialogflow-fulfillment": "^0.4.1",
    "firebase-admin": "~5.4.0",
    "firebase-functions": "^1.1.0",
    "googleapis": "^32.0.0",
    "lodash": "^4.17.10",
    "moment": "^2.22.2",
    "winston": "^3.0.0"
  },
  "private": true,
  "devDependencies": {
    "@babel/cli": "^7.0.0-beta.51",
    "@babel/core": "^7.0.0-beta.51",
    "@babel/preset-env": "^7.0.0-beta.51",
    "firebase-admin": "^5.4.3"
  }
}

Не могли бы вы дать мне некоторые подсказки о том, что происходит и возможные способы исправить это?

...