javascript 从源加载函数定义失败:无法从函数源生成清单:语法错误:意外的标记"",

disbfnqx  于 2022-12-25  发布在  Java
关注(0)|答案(2)|浏览(119)

我一直面临这个firebase模拟器错误,当我试图启动模拟器,它突然停止提供这个错误不断:
从源加载函数定义失败:无法从函数源生成清单:语法错误:意外的标记""。
我尝试了很多不同的方法,但是没有找到任何可能的解决方案来解决这个问题。我更新了firebase函数版本,因为很多人都给出了解决方案,但是这对我不起作用。


我的firebase.json文件:

{
  "hosting": {
    "predeploy": ["npm run --prefix client build"],
    "public": "client/out",
    "cleanUrls": true,
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
    "rewrites": [
      {
        "source": "/app/**",
        "function": "app"
      },
      {
        "source": "/meeting/*",
        "destination": "/meeting.html"
      },
      {
        "source": "/meeting",
        "destination": "/404.html"
      }
    ]
  },
  "functions": {
    "source": "functions"
  },
  "firestore": {
    "indexes": "firestore.indexes.json"
  },

  "emulators": {
    "functions": {
      "port": 3002
    },
    "firestore": {
      "port": 3001
    },
    "ui": {
      "enabled": true
    }
  }
}

函数的package.json文件:

{
  "name": "@minimal/minimal-kit-react",
  "author": "minimals.cc",
  "version": "2.7.0",
  "private": true,
  "scripts": {
    "dev": "next dev -p 3222",
    "build": "next build && next export",
    "start": "next start",
    "lint": "eslint --ext .js,.jsx ./src",
    "lint:fix": "eslint --fix --ext .js,.jsx ./src"
  },
  "browserslist": {
    "production": [
      ">0.5%",
      "last 2 versions",
      "Firefox ESR",
      "not dead",
      "not IE 11",
      "maintained node versions"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "dependencies": {
    "@babel/preset-react": "^7.16.7",
    "@date-io/date-fns": "1.3.13",
    "@emotion/cache": "^11.6.0",
    "@emotion/react": "^11.7.0",
    "@emotion/server": "^11.4.0",
    "@emotion/styled": "^11.6.0",
    "@fullcalendar/daygrid": "^5.10.1",
    "@fullcalendar/interaction": "^5.10.1",
    "@fullcalendar/list": "^5.10.1",
    "@fullcalendar/react": "^5.10.1",
    "@fullcalendar/timegrid": "^5.10.1",
    "@fullcalendar/timeline": "^5.10.1",
    "@iconify/react": "^3.1.0",
    "@material-ui/pickers": "^3.3.10",
    "@mui/icons-material": "^5.2.4",
    "@mui/lab": "^5.0.0-alpha.59",
    "@mui/material": "^5.2.2",
    "@nandorojo/swr-firestore": "^0.16.0",
    "@zeit/next-css": "^1.0.1",
    "@zeit/next-sass": "^1.0.1",
    "axios": "^0.24.0",
    "change-case": "^4.1.2",
    "country-flag-icons": "^1.5.3",
    "date-fns": "^2.27.0",
    "firebase": "^9.6.1",
    "formik": "^2.2.9",
    "framer-motion": "^4.1.17",
    "jwt-check-expiration": "^1.0.5",
    "material-ui-phone-number": "^3.0.0",
    "moment": "^2.29.1",
    "next": "^12.0.7",
    "next-transpile-modules": "^9.0.0",
    "node-sass": "^4.14.1",
    "notistack": "^2.0.3",
    "nprogress": "^0.2.0",
    "otp-input-react": "^0.2.4",
    "prevent-orientation": "^2.1.0",
    "prop-types": "^15.7.2",
    "react": "17.0.2",
    "react-countdown": "^2.3.2",
    "react-dom": "17.0.2",
    "react-drag-drop-files": "^2.2.2",
    "react-intersection-observer": "^8.32.5",
    "react-lazy-load-image-component": "^1.5.1",
    "react-number-format": "^4.9.1",
    "react-otp-input": "^2.4.0",
    "react-phone-input-mui": "^2.9.4",
    "react-phone-number-input": "^3.1.44",
    "react-quill": "^2.0.0-beta.4",
    "react-screen-orientation": "^0.0.4",
    "simplebar": "^5.3.6",
    "simplebar-react": "^2.3.6",
    "stylis": "^4.0.10",
    "stylis-plugin-rtl": "^2.1.1",
    "timezone-support": "^2.0.2",
    "typescript": "^4.4.4",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@next/eslint-plugin-next": "^12.0.7",
    "eslint": "^8.4.0",
    "eslint-config-next": "^12.0.7",
    "eslint-config-prettier": "^8.3.0",
    "prettier": "2.5.1"
  }
}
qv7cva1a

qv7cva1a1#

我得到了同样的问题,我解决了重新安装firebase工具包。
第一个月

xxb16uws

xxb16uws2#

我也遇到了同样的问题。我通过了我的indexiderjs。我意识到我让一个没有主体的函数...

async function myfunctionName()

我把它擦掉了,效果好多了!

相关问题