Firebase-tools: ์—๋ฎฌ๋ ˆ์ดํ„ฐ๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค

์— ๋งŒ๋“  2017๋…„ 12์›” 01์ผ  ยท  42์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: firebase/firebase-tools

Firebase serve --only ๊ธฐ๋Šฅ์„ ์‹คํ–‰ํ•˜๋ ค๊ณ  ํ•  ๋•Œ
๋‹ค์Œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ํ˜ธ์ŠคํŒ… ๋งŒ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.
functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

package.json ์— ๋…ธ๋“œ ์—”์ง„๊ณผ ๋‹ค๋ฅธ ๋…ธ๋“œ ๋ฒ„์ „์ด ์žˆ์„ ๋•Œ ๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.
ํ•ด๊ฒฐ์ฑ…:

์•„๋ž˜๋Š” ์›์‚ฌ์ž…๋‹ˆ๋‹ค. ์ž์œ ๋กญ๊ฒŒ npm์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

# install current working directory dependencies
yarn --ignore-engines

# install firebase-tools if u didn't
yarn global add firebase-tools

# install functions-emulator
yarn global add @google-cloud/functions-emulator --ignore-engines

๋ชจ๋“  42 ๋Œ“๊ธ€

firebase-tools ๋ฅผ ์„ค์น˜ํ•  ๋•Œ ์—๋ฎฌ๋ ˆ์ดํ„ฐ๋ฅผ ์„ค์น˜ํ•˜์ง€ ๋ชปํ•œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค(์„ ํƒ์  ์ข…์†์„ฑ์ด๋ฏ€๋กœ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค). npm install -g firebase-tools ๋ฅผ ๋‹ค์‹œ ์‹คํ–‰ํ•˜๊ณ  ์ถœ๋ ฅ์„ ๊ฒ€์‚ฌํ•˜์—ฌ @google-cloud/functions-emulator ๊ฐ€ ํ•จ๊ป˜ ์œ ์ž…๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

ํ•‘? ํšŒ์‹ ์„ ์›ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด ํ™œ๋™์ด ์—†์–ด ๋ฌธ์„ ๋‹ซ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๋‚˜๋Š” ๊ฐ™์€ ์ผ์„ํ–ˆ๊ณ  ์•„๋ฌด ์†Œ์šฉ์ด์—†๋Š” ๋ชจ๋“ˆ์„ ์„ค์น˜ํ•˜๊ณ  ๋‹ค์‹œ ์„ค์น˜ํ–ˆ์Šต๋‹ˆ๋‹ค.

โžœ Firebase ์„œ๋น„์Šค --์ „์šฉ ๊ธฐ๋Šฅ

=== '์—์„œ ์ œ๊ณต'...

โš  ๊ธฐ๋Šฅ: ์—๋ฎฌ๋ ˆ์ดํ„ฐ๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์˜ค๋ฅ˜: '@google-cloud/functions-emulator/src/config' ๋ชจ๋“ˆ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.
โžœ npm install -g firebase-tools
npm WARN deprecated [email protected] : ๋Œ€์‹  uuid ๋ชจ๋“ˆ ์‚ฌ์šฉ
/์ง‘//.npm-global/bin/firebase -> /home//.npm-global/lib/node_modules/firebase-tools/bin/firebase

  • [email protected]
    89.04s์—์„œ 1๊ฐœ ํŒจํ‚ค์ง€ ์—…๋ฐ์ดํŠธ
    => Firebase ์„œ๋น„์Šค --์ „์šฉ ๊ธฐ๋Šฅ

=== '์—์„œ ์ œ๊ณต'...

โš  ๊ธฐ๋Šฅ: ์—๋ฎฌ๋ ˆ์ดํ„ฐ๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์˜ค๋ฅ˜: '@google-cloud/functions-emulator/src/config' ๋ชจ๋“ˆ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

์—ฌ๊ธฐ๋„ ๋งˆ์ฐฌ๊ฐ€์ง€์ž…๋‹ˆ๋‹ค. ๋ฉฐ์น  ๋™์•ˆ์ด ๋ฐฉ๋ฒ•์ด์—ˆ์Šต๋‹ˆ๋‹ค. ์˜ค๋Š˜ ์—…๋ฐ์ดํŠธ ํ›„์—๋„.

@danielsada ๋ฐ @raelmiu ์‹œ๋„ํ•ด ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

npm uninstall -g firebase-tools && npm i -g firebase-tools

ํ•ด๋ƒˆ์Šต๋‹ˆ๋‹ค. ์ฃผ๋ชฉํ• ๋งŒํ•œ ๊ฒฝ๊ณ  ์ค‘ ์ผ๋ถ€๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.4.1/node-v59-linux-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI) (falling back to source compile with node-gyp) make: Entering directory '/home/danielsada/.npm-global/lib/node_modules/firebase-tools/node_modules/grpc/build'
๊ทธ ๋‹ค์Œ์—

`> @google-cloud/ [email protected] postinstall /home//.npm-global/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator

๋…ธ๋“œ ์Šคํฌ๋ฆฝํŠธ/์—…๊ทธ๋ ˆ์ด๋“œ ๊ฒฝ๊ณ `

๊ทธ๋Ÿฐ ๋‹ค์Œ ๋งˆ์ง€๋ง‰์œผ๋กœ ๋™์ผํ•œ ์˜ค๋ฅ˜

image

๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์ œ๊ฑฐ ๋ฐ ์žฌ์„ค์น˜๋ฅผ ์‹œ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋ˆ„๊ตฌ๋“ ์ง€ ์ด๊ฒƒ์„ ์ž‘๋™ ์‹œ์ผฐ์Šต๋‹ˆ๊นŒ? ์—ฌ์ „ํžˆ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

screen shot 2018-01-25 at 12 59 38 pm

์—ฌ๊ธฐ๋„ ๋งˆ์ฐฌ๊ฐ€์ง€์ž…๋‹ˆ๋‹ค. ๋…ธ๋“œ 6.11์„ ์„ค์น˜ํ•˜๊ณ  ๋„๊ตฌ๋ฅผ ๋‹ค์‹œ ์„ค์น˜ํ–ˆ๋Š”๋ฐ๋„ ์—ฌ์ „ํžˆ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

v3.17.2์—์„œ ๋ณต์ œ ๊ฐ€๋Šฅ

์•ˆ๋…•ํ•˜์„ธ์š” ์—ฌ๋Ÿฌ๋ถ„, v3.17.3์„ ์‚ฌ์šฉํ•ด ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ? @Mir-Ansar๋Š” ๊ถŒํ•œ ์˜ค๋ฅ˜์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์ˆ˜์ • ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ •๋ณด๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. https://docs.npmjs.com/getting-started/fixing-npm-permissions

.3 ๋ฐ .2๋ฅผ ์‹œ๋„ํ–ˆ์ง€๋งŒ ๋™์ผํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.(

์ด์— ๋Œ€ํ•œ ํ•ด๊ฒฐ์ฑ…์ด ์žˆ์Šต๋‹ˆ๊นŒ?

๋ฌธ์ œ๋ฅผ ์žฌํ˜„ํ•  ์ˆ˜ ์—†์–ด ์ฃ„์†กํ•ฉ๋‹ˆ๋‹ค. https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/170#issue -278096938๊ณผ ๋น„์Šทํ•œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ํ•ด๋‹น ๋ฌธ์ œ๋ฅผ +1ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์‹œ๋„ํ•  ์ˆ˜ ์žˆ๋Š” ๋‹ค๋ฅธ ์ž‘์—…์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  • npm์„ ์—…๊ทธ๋ ˆ์ด๋“œ ํ•œ ๋‹ค์Œ ์ œ๊ฑฐํ•˜๊ณ  ๋‹ค์‹œ ์„ค์น˜ํ•˜์‹ญ์‹œ์˜ค.
npm i -g npm
npm unintall -g firebase-tools && npm i -g firebase-tools

๋‚˜๋Š” ๋˜‘๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ๊ณ  ๋Œ€๋ถ€๋ถ„์˜ ์ฃผ์–ด์ง„ ์†”๋ฃจ์…˜์„ ์‹œ๋„ํ–ˆ์ง€๋งŒ ์•„๋ฌด ๊ฒƒ๋„ ํšจ๊ณผ๊ฐ€ ์—†์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์‚ฌ์ด์— ํ•ด๊ฒฐ์ฑ…์„ ์–ป์€ ์‚ฌ๋žŒ์ด ์žˆ์Šต๋‹ˆ๊นŒ?

๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค

์ด ๋ฌธ์ œ์˜ ์›์ธ์ด ์ •ํ™•ํžˆ ๋ฌด์—‡์ธ์ง€ ์ž˜ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์—ฌ๊ธฐ์— ์ด โ€‹โ€‹๋ฌธ์ œ์— ๋Œ€ํ•œ ํšจ๊ณผ์ ์ธ ํ•ด๊ฒฐ์ฑ…์ด ์žˆ์Šต๋‹ˆ๋‹ค. StackOverflow - Firebase: ์—๋ฎฌ๋ ˆ์ดํ„ฐ๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

npm install -g @google-cloud/functions-emulator ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.

@RyanNewsom ์ด ๋‚˜๋ฅผ ์œ„ํ•ด ํ•ด๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค. ์•„์ง ๊ณ ์žฅ๋‚ฌ์Šต๋‹ˆ๋‹ค.

์ž‘๋™ํ•˜๋Š” ์†”๋ฃจ์…˜์ด ์žˆ์Šต๋‹ˆ๊นŒ? ๋‚ด ์—๋ฎฌ๋ ˆ์ดํ„ฐ๊ฐ€ ์ž‘๋™ํ–ˆ์ง€๋งŒ ์ง€๊ธˆ์€ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๋‚˜๋Š” ๋‘ ๊ฐœ์˜ ์œ ์‚ฌํ•œ ํ”„๋กœ์ ํŠธ๊ฐ€ ์žˆ๋Š”๋ฐ ํ•˜๋‚˜๋Š” ์ž‘๋™ํ•˜๊ณ  ํ•˜๋‚˜๋Š” ์œ„์˜ ์„ค๋ช…์— ๋”ฐ๋ผ ์ž‘๋™ํ•˜์ง€ ์•Š์œผ๋ฉฐ ์ž‘๋™ ์ค‘์ด๋˜ Firebase ๋ฐฐํฌ๊ฐ€ ์ด์ œ ์„ค๋ช…ํ•  ์ˆ˜ ์—†์„ ์ •๋„๋กœ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ ๋‹ฌ ๋™์•ˆ ์—ฌ๊ธฐ์™€ stackOverflow ๋ชจ๋‘์—์„œ ์ด์™€ ๊ฐ™์€ ์šด๋ช…์œผ๋กœ ๊ณ ํ†ต๋ฐ›๋Š” ์‚ฌ๋žŒ๋“ค์˜ ์ˆ˜๋ฅผ ๋ณด๋ฉด ๋œ ๋ถ€์„œ์ง€๊ธฐ ์‰ฌ์šด ์‹œ์Šคํ…œ์ด ์ ์ ˆํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์ด ๋ฌธ์ œ์˜ ์›์ธ์€ ๋Œ€๋ถ€๋ถ„์˜ ๊ฒฝ์šฐ Firebase๋ฅผ ์„ค์น˜ํ•  ๋•Œ ์ž˜๋ชป๋œ Python ๋ฒ„์ „ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

python 2 ์™€ ํ•จ๊ป˜ ์‰˜์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•œ ๋‹ค์Œ ๋‹ค์‹œ ์‹คํ–‰ํ•˜์‹ญ์‹œ์˜ค.
npm install -g firebase-tools

์ตœ์‹  firebase-tools(v3.17.5)๋Š” ์ด๋Ÿฌํ•œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•ด์•ผ ํ•˜๋Š” ์ข…์†์„ฑ์œผ๋กœ grpc๋ฅผ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค. npm i -g firebase-tools ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ์—…๊ทธ๋ ˆ์ด๋“œํ•˜์‹ญ์‹œ์˜ค.

๋‚˜๋ฅผ ์œ„ํ•ด ๊ทธ๊ฒƒ์„ ๊ณ ์ณค๋‹ค.

package.json ์— ๋…ธ๋“œ ์—”์ง„๊ณผ ๋‹ค๋ฅธ ๋…ธ๋“œ ๋ฒ„์ „์ด ์žˆ์„ ๋•Œ ๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.
ํ•ด๊ฒฐ์ฑ…:

์•„๋ž˜๋Š” ์›์‚ฌ์ž…๋‹ˆ๋‹ค. ์ž์œ ๋กญ๊ฒŒ npm์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

# install current working directory dependencies
yarn --ignore-engines

# install firebase-tools if u didn't
yarn global add firebase-tools

# install functions-emulator
yarn global add @google-cloud/functions-emulator --ignore-engines
โš   functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'
(node:15281) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'exit' of undefined
    at /usr/local/lib/node_modules/firebase-tools/lib/command.js:82:34
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:15281) 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(). (rejection id: 2)
(node:15281) [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.

@ddo ๋ฐฉ๋ฒ•์„ ์‹œ๋„ํ–ˆ์ง€๋งŒ ์ž‘๋™ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

โš   functions: Cannot start emulator. Error: Cannot find module '@google-cloud/functions-emulator/src/config'
(node:15281) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'exit' of undefined
    at /usr/local/lib/node_modules/firebase-tools/lib/command.js:82:34
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:15281) 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(). (rejection id: 2)
(node:15281) [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.

@ddo ๋ฐฉ๋ฒ•์„ ์‹œ๋„ํ–ˆ์ง€๋งŒ ์ž‘๋™ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

์ผํ•œ ํ›„ :

  1. NVM์„ ์‚ฌ์šฉํ•˜์—ฌ ๋…ธ๋“œ ๋ฐ NPM ๋‹ค์‹œ ์„ค์น˜
  2. /usr/local/lib/node_modules ์—์„œ firebase-tools ์‚ญ์ œ(๋˜๋Š” ๋ฃจํŠธ ์ˆ˜์ค€ ๋…ธ๋“œ์—์„œ ์„ค์น˜๋œ ์ด์ „ ์ „์—ญ ํŒจํ‚ค์ง€)
  3. sudo ์—†์ด firebase-tools ์„ค์น˜ ( npm i -g firebase-tools )

sdfsdfadf

๋‚˜๋Š” ๋˜ํ•œ ์ตœ๊ทผ์— ๋…ธ๋“œ 8์„ ์‚ฌ์šฉํ•˜๋„๋ก ์—…๊ทธ๋ ˆ์ด๋“œํ–ˆ๊ณ  firebase serve --only functions ๋ฐ firebase-tools --ignore-engines ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค @google-cloud/[email protected]: The engine "node" is incompatible with this module. Expected version "~6". Got "8.1.0" ๊ทธ๊ฒƒ์€ ์ž˜ ์‹คํ–‰๋˜์ง€๋งŒ ๊ฒฝ๊ณ ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค

[Jest Dev server] $ firebase serve --only functions -p 5000 -o 0.0.0.0
[Jest Dev server]
[Jest Dev server] === Serving from '/Users/xxx/project-name'...
[Jest Dev server]
[Jest Dev server] i  functions: Preparing to emulate functions.
[Jest Dev server] Warning: You're using Node.js v8.1.0 but Google Cloud Functions only supports v6.11.5.

๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜๋ฉด Firebase ์‚ฌ์šฉ์„ ์ค‘๋‹จํ•˜๊ธฐ๋งŒ ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๊ฒŒ ๋‹ค์•ผ

2018๋…„ 11์›” 14์ผ ์ˆ˜์š”์ผ ์˜ค์ „ 1:03 rilian [email protected] ์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ผ์Šต๋‹ˆ๋‹ค.

๋‚˜๋Š” ๋˜ํ•œ ์ตœ๊ทผ์— ๋…ธ๋“œ 8์„ ์‚ฌ์šฉํ•˜๋„๋ก ์—…๊ทธ๋ ˆ์ด๋“œํ–ˆ์œผ๋ฉฐ Firebase์— ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
serve --์™„์ „ํžˆ ์„ค์น˜ํ•˜์ง€ ์•Š์œผ๋ ค๋Š” ๊ธฐ๋Šฅ ๋ฐ Firebase ๋„๊ตฌ๋งŒ
@google-cloud/ [email protected] : ์—”์ง„ "๋…ธ๋“œ"๋Š”
์ด ๋ชจ๋“ˆ๊ณผ ํ˜ธํ™˜๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์˜ˆ์ƒ ๋ฒ„์ „ "~6"์ž…๋‹ˆ๋‹ค. "8.1.0"์ด ์žˆ์ง€๋งŒ
--ignore-engines๋Š” ์ •๋ง ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.
๊ฒฝ๊ณ 

[Jest Dev ์„œ๋ฒ„] $ firebase serve --only functions -p 5000 -o 0.0.0.0
[์ œ์ŠคํŠธ ๊ฐœ๋ฐœ ์„œ๋ฒ„]
[Jest Dev ์„œ๋ฒ„] === '/Users/xxx/project-name'์—์„œ ์ œ๊ณต ์ค‘...
[์ œ์ŠคํŠธ ๊ฐœ๋ฐœ ์„œ๋ฒ„]
[Jest Dev ์„œ๋ฒ„] i functions: ๊ธฐ๋Šฅ ์—๋ฎฌ๋ ˆ์ด์…˜ ์ค€๋น„.
[Jest Dev ์„œ๋ฒ„] ๊ฒฝ๊ณ : Node.js v8.1.0์„ ์‚ฌ์šฉ ์ค‘์ด์ง€๋งŒ Google Cloud Functions๋Š” v6.11.5๋งŒ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

โ€”
๋‹น์‹ ์ด ๋Œ“๊ธ€์„ ๋‹ฌ์•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๊ฒƒ์„ ๋ฐ›๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
์ด ์ด๋ฉ”์ผ์— ์ง์ ‘ ๋‹ต์žฅํ•˜๊ณ  GitHub์—์„œ ํ™•์ธํ•˜์„ธ์š”.
https://github.com/firebase/firebase-tools/issues/552#issuecomment-438375329 ,
๋˜๋Š” ์Šค๋ ˆ๋“œ ์Œ์†Œ๊ฑฐ
https://github.com/notifications/unsubscribe-auth/Acq9nGZycDnglAuFYQiMNNVaQX9XEyTRks5uuwl-gaJpZM4Qx6cx
.

๊ตฌํ•ด์ค˜:
yarn global remove @google-cloud/functions-emulator
yarn global add https://github.com/GoogleCloudPlatform/cloud-functions-emulator#master

firebase-admin ๋ฐ ๊ธฐํƒ€ ์ผ๋ถ€ Firebase ํŒจํ‚ค์ง€๋„ ์—…๊ทธ๋ ˆ์ด๋“œํ•œ ํ›„ ์ด ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๋…ธ๋“œ 8์—์„œ ๊ธฐ๋Šฅ์„ ์‹คํ–‰ ์ค‘์ž…๋‹ˆ๋‹ค --ignore-engines ๋กœ Firebase๋ฅผ ์„ค์น˜ํ–ˆ๋Š”์ง€ ํ™•์ธํ•˜์—ฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

ํ”„๋กœ์ ํŠธ์—์„œ ์ฃผ๋กœ yarn์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ firebase-tools๋ฅผ ์„ค์น˜ํ•  ๋•Œ yarn ๋Œ€์‹  npm์„ ์‚ฌ์šฉํ•˜์„ธ์š”.

yarn global remove firebase-tools
npm i - g firebase-tools

๋‚˜๋ฅผ ์œ„ํ•ด ์ผํ–ˆ์Šต๋‹ˆ๋‹ค : Mac์˜ docker ๋‚ด๋ถ€์—์„œ์ด ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์•„๋ฌด๊ฒƒ๋„ ํ•ด๊ฒฐํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค. Mac์— ์„ค์น˜ํ•œ ๋‹ค์Œ docker์˜ node_modules ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๊ฒŒ ํšจ๊ณผ๊ฐ€ ์žˆ์—ˆ๋‹ค.

๋˜ํ•œ ๋…ธ๋“œ 8 ๊ธฐ๋Šฅ์œผ๋กœ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ํ•œ ํ›„ ์œ„์˜ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์–ธ๊ธ‰ํ•œ ๋Œ€๋กœ --ignore-engines ๋ฅผ ์‚ฌ์šฉํ•˜์ง€๋งŒ ์—ฌ์ „ํžˆ ์ด ๊ฒฝ๊ณ ๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

๊ฒฝ๊ณ : Node.js v8.14.0์„ ์‚ฌ์šฉ ์ค‘์ด์ง€๋งŒ Google Cloud Functions๋Š” v6.11.5๋งŒ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

@Dygerati ๋„ ๋งˆ์ฐฌ๊ฐ€์ง€์ž…๋‹ˆ๋‹ค.

์ด๊ฒƒ์ด ๋‚ด๊ฐ€ ์–ป์€ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋ˆ„๊ตฌ๋“ ์ง€์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐ ํ–ˆ์Šต๋‹ˆ๊นŒ?

functions: Cannot start emulator. Error: Cannot find module './acceleratedmobilepageurl/v1'
(node:16724) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'exit' of undefined
    at C:\....\node_modules\firebase-tools\lib\command.js:82:34
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:16724) 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(). (rej
ection id: 2)
(node:16724) [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.

npm install @google-cloud/functions-emulator --save-dev ํ•ด๊ฒฐ๋จ

์ข‹์Šต๋‹ˆ๋‹ค. Google Cloud-functions-emulator๋Š” "Node v6.xx๋งŒ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. Node v8.xx๋Š” ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."
https://github.com/GoogleCloudPlatform/cloud-functions-emulator#note

๋…ธ๋“œ ๋ฒ„์ „ ์„ ํƒ์— ๋Œ€ํ•œ Firebase ๋ฌธ์„œ์—๋Š” ๋…ธ๋“œ 8 "engines": {"node": "8"} ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค๊ณ  ๋‚˜์™€ ์žˆ์Šต๋‹ˆ๋‹ค.
ํ•˜์ง€๋งŒ ๋ฒ ํƒ€ ๋ฒ„์ „์ž…๋‹ˆ๋‹ค..
https://firebase.google.com/docs/functions/manage-functions#set_nodejs_version

ํ ... ๊ทธ๋ž˜์„œ node8์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ํด๋ผ์šฐ๋“œ ๊ธฐ๋Šฅ ์…ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋กœ์ปฌ์—์„œ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค(node8 ํŠน์ • ๊ตฌ๋ฌธ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ)?
๋‚˜์—๊ฒŒ ์ด ๊ถŒ๋ฆฌ๊ฐ€ ์žˆ์Šต๋‹ˆ๊นŒ?

Firebase ํŒ€/๊ตฌ๊ธ€ ํŒ€, ํด๋ผ์šฐ๋“œ ๊ธฐ๋Šฅ ์—๋ฎฌ๋ ˆ์ดํ„ฐ๊ฐ€ ๋…ธ๋“œ 8์—์„œ ์ž‘๋™ํ•˜์ง€ ์•Š๋Š”๋‹ค๋Š” ๋ฌธ์„œ๋ฅผ ์ž‘์„ฑํ•ด ์ฃผ์‹œ๋ฉด ๋„์›€์ด ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.
์˜ˆ๋ฅผ ๋“ค์–ด ์ด ํŽ˜์ด์ง€์—์„œ https://firebase.google.com/docs/functions/manage-functions#set_nodejs_version ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

"๋Ÿฐํƒ€์ž„์„ ๋…ธ๋“œ 8๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ google cloud-functions-emulator๋กœ ํ…Œ์ŠคํŠธํ•˜๋ฉด node6.xx๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  node8 ํŠน์ • ๊ตฌ๋ฌธ์€ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."

์—ฌ๊ธฐ์— ๋น„์Šทํ•œ ๊ฒฝ๊ณ ๊ฐ€ ๋„์›€์ด ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค
https://firebase.google.com/docs/functions/local-emulator#install_and_configure_the_cloud_functions_shell

๊ท€ํ•˜๊ฐ€ ๋ณด๋‚ธ ์ด๋ฉ”์ผ์—์„œ๋„ (2019๋…„ 2์›” 25์ผ)
์ œ๋ชฉ: [์กฐ์น˜ ํ•„์š”] 4์›” 1์ผ๋ถ€ํ„ฐ ์ƒˆ๋กœ์šด Cloud Functions ๋ฐฐํฌ๋ฅผ ์œ„ํ•œ ๋Ÿฐํƒ€์ž„ ๋ณ€๊ฒฝ ์‚ฌํ•ญ

@julianorinyol ๊ณผ ๋˜‘๊ฐ™์€ ์งˆ๋ฌธ์œผ๋กœ ์—ฌ๊ธฐ์— ์™”์Šต๋‹ˆ๋‹ค. Node 8 ๊ตฌ๋ฌธ๊ณผ ํ˜ธํ™˜๋˜๋Š” ์ง€์ ๊นŒ์ง€ ์—๋ฎฌ๋ ˆ์ดํ„ฐ๋ฅผ ๋งŒ๋“ค ๊ณ„ํš์ด ์žˆ์Šต๋‹ˆ๊นŒ?

๋…ธ๋“œ 8(์›์‚ฌ ํฌํ•จ)์—์„œ ์‚ฌ์šฉํ•˜๋ฉด ์ด๊ฒƒ์ด ๋‚˜๋ฅผ ์œ„ํ•ด ์ผํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.
yarn add @google-cloud/functions-emulator --ignore-engines

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰