๋
ธ๋ : 8.16.0
firebase-functions : 2.3.0
firebase-tools : 6.9.1 ( ์ฐธ๊ณ : 6.8.0์์ ์๋)
firebase-admin : 7.3.0
๋๋ ์ด๊ฒ์ Windows 10์์ ์คํํ๊ณ ์์ต๋๋ค.
ํจ์์ ํจ๊ป firebase init
๋ฅผ ์ฌ์ฉํ์ฌ ์๋ก ์์ฑ ๋ Firebase ํ๋ก์ ํธ์
๋๋ค.
npm run start
(๋๋ firebase functions:shell
) ์คํ
์๋ฎฌ๋ ์ดํฐ๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์์๋ฉ๋๋ค.
๋ค์ ๋ก๊ทธ๊ฐ ํ์๋ฉ๋๋ค.
! The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i functions: Your functions could not be parsed due to an issue with your node_modules (see above)
์, ๋ฐฐํฌ๊ฐ ์ ์๋ํฉ๋๋ค. ๋ฐฐํฌ ๋ ํจ์ (hello world)๋
์ด ๋ฌธ์ ์ ๋ ์ด๋ธ์ ์ง์ ํ๋ ๋ฐฉ๋ฒ์ ์ ์ ์์ด์ ์ฌ๋์ด ๋ถ๋ฅ ํ ์ ์๋๋ก ๋ ์ด๋ธ์ ์ง์ ํ์ต๋๋ค. ๊ผญ ๋ถ์ก์.
์๋ฎฌ๋ ์ด์ ์ด ๊ตฌํ๋๋ firebase-tools๋ก ์ด๋ํฉ๋๋ค.
์๋ฎฌ๋ ์ดํฐ๋ [email protected]
ํฉ๋๋ค. ์ด ๋ฌธ์ ๋ # 1243 ๋ฐ # 1258๊ณผ ๊ด๋ จ์ด์์ ์ ์์ต๋๋ค.
๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
โ functions: Using node<strong i="6">@8</strong> from host.
โ functions: Emulator started at http://localhost:5001
i functions: Watching "/home/yerzhan/projects/askimam/functions" for Cloud Functions...
โ The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i functions: Your functions could not be parsed due to an issue with your node_modules (see above)
firebase -V
6.9.1
"dependencies": {
"firebase-admin": "^7.3.0",
"firebase-functions": "^2.3.0"
},
firebase-admin ํจํค์ง๋ node_modules์ ์กด์ฌํฉ๋๋ค.
[2019-05-09T09:19:26.091Z] ----------------------------------------------------------------------
[2019-05-09T09:19:26.093Z] Command: /home/yerzhan/node-v8.12.0-linux-x64/bin/node /home/yerzhan/node-v8.12.0-linux-x64/bin/firebase emulators:start --debug
[2019-05-09T09:19:26.093Z] CLI Version: 6.9.1
[2019-05-09T09:19:26.093Z] Platform: linux
[2019-05-09T09:19:26.093Z] Node Version: v8.12.0
[2019-05-09T09:19:26.094Z] Time: Thu May 09 2019 15:19:26 GMT+0600 (+06)
[2019-05-09T09:19:26.094Z] ----------------------------------------------------------------------
[2019-05-09T09:19:26.099Z] > 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"]
[2019-05-09T09:19:26.099Z] > authorizing via signed-in user
[2019-05-09T09:19:26.100Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[2019-05-09T09:19:26.100Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[2019-05-09T09:19:26.891Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=utf-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 09 May 2019 09:19:26 GMT, server=scaffolding on HTTPServer2, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, transfer-encoding=chunked
[2019-05-09T09:19:26.901Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/azan-kz-ask-imam
[2019-05-09T09:19:28.625Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 09 May 2019 09:19:28 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=923, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, transfer-encoding=chunked
i Starting emulators: ["functions"]
โ functions: Using node<strong i="5">@8</strong> from host.
[2019-05-09T09:19:28.637Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/674391970261:getServerAppConfig
[2019-05-09T09:19:29.356Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 09 May 2019 09:19:29 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, transfer-encoding=chunked
โ functions: Emulator started at http://localhost:5001
i functions: Watching "/home/yerzhan/projects/askimam/functions" for Cloud Functions...
[2019-05-09T09:19:29.813Z] Functions runtime initialized.
[2019-05-09T09:19:29.813Z] Disabled runtime features: undefined
โ The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i functions: Your functions could not be parsed due to an issue with your node_modules (see above)
๋๋ ๋์ผํ๊ณ ์ฐพ์ ํด๊ฒฐ์ฑ
์ด ์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ alias ๋ช
๋ น์ ์ฌ์ฉํ ์ ์์ต๋๋ค. "yarn serve"๋๋ "npm serve"
"scripts"๋ธ๋ก์ packages.json์์ ํธ์ถํฉ๋๋ค.
์ฌ๊ธฐ์ ๊ฐ์ ๋ฌธ์ ! 3 ์๊ฐ ๋์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ฐพ์์ง๋ง ์ฑ๊ณตํ์ง ๋ชปํ์ต๋๋ค.
์ค๋ ์ ๋ firebase-admin์ global npm์ ์ถ๊ฐํ๋ ๊ฒ์ ๋ํด ์๊ฐํ์ง๋ง ์๋ํ ์ง ํ์คํ์ง ์์ต๋๋ค.
@namcoder ์ ์์ ์๋ํด ๋ณผ ๊ฒ์
๋๋ค.
@diogolessa firebase -tools 6.8.0์ผ๋ก ๋ค์ด ๊ทธ๋ ์ด๋ํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ฉ๋๋ค. ์ต์ ์ด ์๋๋๊น?
๋ฌผ๋ก ์ ๋๋ค ... ๋ ๋์ ์ ๊ทผ ๋ฐฉ์ ์ธ ๊ฒ ๊ฐ์ต๋๋ค. ๊ทธ๋๋ ๋ ๊ฐ์ ์ด๋ณด์๋ฅผ ์ํด ๋ชจ๋ ์ต์ ๋ฒ์ ์ด ์ ์์ ์ผ๋ก ์๋ํ๋ ๊ฒ์ด ์ข์ ๊ฒ์ ๋๋ค. ๊ฐ์ฌํฉ๋๋ค @ExtraBB
์ฌ๊ธฐ๋ ๋ง์ฐฌ๊ฐ์ง์ ๋๋ค ... ๋ฆฌ๋ ์ค์์๋ ๋ฐ์ํฉ๋๋ค.
ํธ์ง : ๋ค์ด ๊ทธ๋ ์ด๋ "์์ "ํ์ธ.
์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ฌ firebase-tools๋ฅผ ์ ๊ฑฐํ๊ณ [email protected]์ ๋ค์ ์ค์นํ์ต๋๋ค .
๊ฐ์ ๋ฌธ์ .. ๋ค์ด ๊ทธ๋ ์ด๋๊ฐ ์๋ํ๋๋กํ๋ ์ ์ผํ ๋ฐฉ๋ฒ์ ๋๋ค.
ํ์ฌ ์๋ํ๋ ์ค์ ๋ง
firebase-functions : 2.3.0
firebase-tools : 6.8.0
firebase-admin : 7.3.0
์๋
ํ์ธ์ ์ฌ๋ฌ๋ถ,์ด ๋ฌธ์ ๋ก ์ธํ ๋ฌธ์ ์ ๋ํด ์ฃ์กํฉ๋๋ค. ์ง๊ธ์ ํจ์น ์์
์ํ๋ ๋์ 6.8.0
๋ค์ด ๊ทธ๋ ์ด๋ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
์ด ๋ฌธ์ ๋ slowRequireResolve
์ฌ์ฉํด์ผํ๋ verifyDeveloperNodeModules()
์ ๊ธฐ๋ณธ require.resolve
์ฌ์ฉ์ผ๋ก ์ธํด ๋ฐ์ํฉ๋๋ค. ๋ค์ดํฐ๋ธ require.resolve
์ ๋ค๋ฅธ ์ฌ์ฉ ๋ ๋์ผํ ๋ฌธ์ ๋ฅผ ๊ฒช์ต๋๋ค.
require.resolve
๊ฐ ํ
์คํธ์์ ์คํ๋ ๋ firebase-tools
์ dev ์ข
์์ฑ์ผ๋ก ํ์ธ ๋์๊ธฐ ๋๋ฌธ์ ํ
์คํธ์์ ํฌ์ฐฉ๋์ง ์์์ผ๋ฏ๋ก require.resolve
์ slowRequireResolve
firebase-tools
๋ฒ์ 6.9.0
๋ฐ 6.9.1
์ ๋ฒ๊ทธ์
๋๋ค. ํด๊ฒฐ์ฑ
์ ์ง๊ธ 6.8.0
๋ก ๋ค์ด ๊ทธ๋ ์ด๋ํ๋ ๊ฒ์
๋๋ค.
npm install -g [email protected]
์ ๋ฐ์ดํธ ํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค. 6.8.0์ผ๋ก ๋ค์ด ๊ทธ๋ ์ด๋ํ๋ ๊ฒ์ด ํจ๊ณผ์ ์ด์์ต๋๋ค.
์ด๊ฒ์ ํ์ฌ ๋ก์ปฌ์์ ํจ์๋ฅผ ์คํํ๊ธฐ์ํ firebase ๋ฌธ์์ ๋ฌธ์ํ๋์ด ์์ง ์์ผ๋ฉฐ ์์ ์ด ์์ง ์ค๋น๋์ง ์์ ๊ฒฝ์ฐ ํ์คํ ํ์ํฉ๋๋ค.
์ข์ต๋๋ค. ์ค๋ 6.9.2
์ถ์ ๋ ์ด ๋ฌธ์ ์ ๋ํ ์์ ์ฌํญ์ ๋ณํฉํ์ต๋๋ค. ๋ฆด๋ฆฌ์คํ๊ธฐ ์ ์ # 1265์ ๋ํ ์์ ์ ๊ธฐ๋ค๋ฆด ์ ์์ง๋ง ๊ทธ๋๋ ํด๊ฒฐ๋์ง ์์ผ๋ฉด ๊ทธ๋๋ก ์ข
๋ฃ๋ฉ๋๋ค. ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋๋ฉด์ด ๋ฒ๊ทธ๋ฅผ ์ข
๋ฃํ๊ฒ ์ต๋๋ค. ๋ฌธ์ ๊ฐ ๊ณ์ ๋ฐ์ํ๋ฉด ๋ค์ ์ด์ด์ฃผ์ธ์.
# 1263์ ์ํด ์์ ๋จ
์ด ์์ ์ผ๋ก 6.9.2
๋ฒ์ ์ด ๋ฆด๋ฆฌ์ค๋์์ต๋๋ค.
์ด ์๋ก์ด ๋ฆด๋ฆฌ์ค์ ๊ด๋ จ์ด ์๋์ง ๊ถ๊ธํดํ๋ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
AssertionError [ERR_ASSERTION]: missing path
at Module.require (module.js:595:3)
at require (internal/module.js:11:18)
at InitializeFirebaseAdminStubs
6.8.0์์ 6.9.2๋ก ์ ๊ทธ๋ ์ด๋๋์์ผ๋ฉฐ ํ์ฌ ๋ค์์ด ํ์๋ฉ๋๋ค.
๊ธฐ๋ฅ : ํธ์คํธ์์ node @ 8 ์ฌ์ฉ.
- ํจ์ : http : // localhost : 5001์์ ์์๋ ์๋ฎฌ๋ ์ดํฐ
! Cloud Functions ์๋ฎฌ๋ ์ดํฐ๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด 'firebase-functions-test'๋ชจ๋์ ๊ฐ๋ฐ ์ข ์์ฑ์ผ๋ก ์ค์นํด์ผํฉ๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๋ฉด functions ๋๋ ํ ๋ฆฌ์์ 'npm install --save-dev firebase-functions-test'๋ฅผ ์คํํ์ธ์.
i ํจ์ : node_modules์ ๋ฌธ์ ๋ก ์ธํด ํจ์๋ฅผ ๊ตฌ๋ฌธ ๋ถ์ ํ ์ ์์ต๋๋ค (์ ์ฐธ์กฐ).
6.9.2๋ก ์ ๊ทธ๋ ์ด๋ ํ ํ ๋ง์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
๋ฒ์ 6.9.2๊ฐ์ด ์์ ๊ณผ ํจ๊ป ๋ฆด๋ฆฌ์ค๋์์ต๋๋ค.
์์ ์ฌํญ์ด ๊ณ ์ฐฉ๋์ง ์์์ต๋๋ค. "firebase-tools": "^6.10.0"
์์์ด ์ค๋ฅ๊ฐ ํ์๋ฉ๋๋ค.
Cloud Functions ์๋ฎฌ๋ ์ดํฐ๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด 'firebase-admin'๋ชจ๋์ ๋ฒ์ ์ด 7.0.0 ์ด์์ด์ด์ผํ๋ฏ๋ก ๋ฒ์ ์ด ๋๋ฌด ์ค๋๋์์ต๋๋ค. ํจ์ ๋๋ ํ ๋ฆฌ์์ "npm install firebase-admin @ latest "๋ฅผ ์คํํ์ฌ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์ต๋๋ค.
์ค์น์ ์๋ ์
๊ทธ๋ ์ด๋๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํด ํ์ฌ package.json ์ข
์์ฑ์์ ^
๋ฅผ ์ ๊ฑฐํ์ต๋๋ค.
"firebase-tools": "^6.8.0", // before
"firebase-tools": "6.8.0", // after
@diogolessa firebase -tools 6.8.0์ผ๋ก ๋ค์ด ๊ทธ๋ ์ด๋ํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ฉ๋๋ค. ์ต์ ์ด ์๋๋๊น?
๊ฐ์ฌํฉ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
firebase-tools
๋ฒ์ 6.9.0
๋ฐ6.9.1
์ ๋ฒ๊ทธ์ ๋๋ค. ํด๊ฒฐ์ฑ ์ ์ง๊ธ6.8.0
๋ก ๋ค์ด ๊ทธ๋ ์ด๋ํ๋ ๊ฒ์ ๋๋ค.์ฐธ์กฐ : https://stackoverflow.com/a/56065094/4319131