Firebase deploy error - Running command:npm --prefix“$RESOURCE_RESOURCE”run lint results in /bin/sh:0:Illegal option --

zzlelutf  于 2023-11-21  发布在  其他
关注(0)|答案(1)|浏览(120)

我已经部署了上千次没有问题,每次都运行lint,现在突然我得到一个Illegal option --错误,部署失败。
firebase --version: 12.9.1node -v v16.16.0yarn --version: 3.5.0
尝试删除node_modules,firebase init,并重新安装所有内容。我最近更新到firebase 12. 9. 1。尝试降级到12. 8. 1。可能是环境问题,但碰壁,并已在这一个整整一天。

me@command:~/AndroidStudioProjects/MyDir/functions$ firebase deploy --only functions:eventDates

=== Deploying to 'my-project'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> [email protected] lint
> eslint --ext .js,.ts .

/bin/sh: 0: Illegal option --

Error: functions predeploy error: Command terminated with non-zero exit code 2

字符串
firebase.json**

{
  "functions": [
    {
      "source": "functions",
      "ignore": [
        "node_modules",
        ".git",
        ".cache",
        "firebase-export*",
        ".vscode",
        ".idea",
        "*.log",
        "*.html",
        "README.md",
        "cache"
      ],
      "predeploy": [
        "npm --prefix \"$RESOURCE_DIR\" run lint",
        "npm --prefix \"$RESOURCE_DIR\" run build"
      ],
      "codebase": "default"
    }
  ],
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "hosting": {
    "public": "build/web",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
  "storage": {
    "rules": "storage.rules"
  },
  "emulators": {
    "auth": {
      "host": "0.0.0.0",
      "port": 9099
    },
    "functions": {
      "host": "0.0.0.0",
      "port": 5001
    },
    "firestore": {
      "host": "0.0.0.0",
      "port": 8087
    },
    "hosting": {
      "host": "0.0.0.0",
      "port": 5003
    },
    "pubsub": {
      "host": "0.0.0.0",
      "port": 8085
    },
    "storage": {
      "host": "0.0.0.0",
      "port": 9199
    },
    "eventarc": {
      "host": "0.0.0.0",
      "port": 9299
    },
    "ui": {
      "enabled": true
    },
    "singleProjectMode": true
  }
}

package.json

{
  "name": "functions",
  "scripts": {
    "lint": "eslint --ext .js,.ts .",
    "build": "tsc",
    "build:watch": "tsc --watch",
    "serve": "npm run build && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "dev": "cd ~/AndroidStudioProjects/MyDir && firebase emulators:start --import=saved-data --export-on-exit && tsc --watch",
    "debug": "cd ~/AndroidStudioProjects/MyDir && firebase emulators:start --import=saved-data --export-on-exit --inspect-functions && tsc --watch",
    "deploy": "cd functions && npm ci && npm run build && cd .. && firebase deploy --only hosting",
    "web": "cd ~/AndroidStudioProjects/MyDir && flutter run -d chrome --web-renderer canvaskit --web-hostname localhost --web-port 45887",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "16"
  },
  "main": "lib/index.js",
  "dependencies": {
    "@aws-sdk/client-s3": "^3.451.0",
    "@google-cloud/pubsub": "^2.15.1",
    "@google-cloud/secret-manager": "^3.7.1",
    "@sendgrid/mail": "^7.6.0",
    "algoliasearch": "^4.10.2",
    "aws-sdk": "^2.1231.0",
    "axios": "^0.27.2",
    "cors": "^2.8.5",
    "eslint": "^8.23.0",
    "express": "^4.18.2",
    "ffmpeg-static": "^4.4.0",
    "firebase-admin": "^11.8.0",
    "firebase-functions": "^4.3.1",
    "lodash": "^4.17.21",
    "luxon": "^1.27.0",
    "node-fetch": "^2.6.7",
    "uuid": "^8.3.2"
  },
  "devDependencies": {
    "@types/ffmpeg-static": "^3.0.0",
    "@types/luxon": "^1.27.0",
    "@types/node-fetch": "^2.6.1",
    "@types/request": "^2.48.7",
    "@types/uuid": "^9.0.0",
    "@typescript-eslint/eslint-plugin": "^5.12.0",
    "@typescript-eslint/parser": "^5.12.0",
    "eslint": "^8.9.0",
    "eslint-config-google": "^0.14.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-prettier": "^4.2.1",
    "firebase-functions-test": "^3.1.0",
    "prettier": "^2.7.1",
    "typescript": "^4.9.0"
  },
  "private": true,
  "version": "1.0.0",
  "author": "",
  "license": "ISC",
  "description": ""
}

7kjnsjlb

7kjnsjlb1#

我的用例的解决方案最终是通过删除节点16重新安装它,然后运行nvm install 16,然后通过运行npm i -g [[email protected]](https://stackoverflow.com/cdn-cgi/l/email-protection)firebase-tools从v12.9.1降级到12.8.1。我将向Firebase工具github项目报告这一点。

相关问题