Firebase云功能无法在日志中找到模块错误

时间:2018-02-07 07:30:31

标签: javascript node.js firebase google-cloud-functions nextjs

我正在尝试Serve Dynamic Content with Cloud FunctionsNextJS

当我运行firebase serve时,所有内容都在本地运行。

但是当我运行firebase deploy并尝试运行我的函数时,我在firebase函数日志中得到以下错误。

enter image description here

Error: Cannot find module 'babel-runtime/core-js/object/get-prototype-of'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/user_code/next/dist/pages/_document.js:7:23)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

我不是直接使用babel(我正在使用typescript),所以我的一个模块必须使用它作为依赖。

我猜我已经在我的本地机器上安装了一些全局内容并且它不存在于我的云功能中,但我该如何调试它会是什么?我尝试将babel-runtime添加到我的package.json

node -v v6.11.5

package.json

{
  "name": "functions",
  "scripts": {
    "dev": "next",
    "build": "next build",
    "start": "next start",
    "lint": "./node_modules/.bin/tslint -p tslint.json",
    "build-js": "./node_modules/.bin/tslint -p tslint.json && ./node_modules/.bin/tsc && cp package.json ../../build/functions/package.json"
  },
  "main": "index.js",
  "dependencies": {
    "async": "^2.6.0",
    "@babel/runtime": "^7.0.0-beta.39",
    "express": "^4.15.4",
    "firebase-admin": "~5.8.1",
    "firebase-functions": "^0.8.1",
    "googleapis": "^23.0.0",
    "next": "^4.2.1",
    "range-inclusive": "^1.0.2",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "request": "^2.83.0",
    "request-promise": "^4.2.2",
    "typescript": "^2.7.1"
  },
  "devDependencies": {
    "@babel/preset-env": "^7.0.0-beta.39",
    "babel-runtime": "^6.26.0",
    "tslint": "^5.8.0",
    "typescript": "^2.7.1"
  },
  "private": true
}

0 个答案:

没有答案