NodeJS npm err missing script lint when deploying

htzpubme  于 2023-04-20  发布在  Node.js
关注(0)|答案(4)|浏览(282)

When running the following command:

npm --prefix "$RESOURCE_DIR" run lint

It returns the following error:
npm ERR! missing script: lint
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Roaming\npm-cache\_logs\2018-04-13T01_27_59_009Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code1
This is my package.json :

"name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase serve --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "dependencies": {
    "firebase-admin": "~5.12.0",
    "firebase-functions": "^1.0.1"
  },
  "private": true
}
rsaldnfx

rsaldnfx1#

您正在尝试运行lint任务,但该任务在您的包定义中不存在。是否确实不想运行以下操作(基于您的问题标题)?

npm --prefix "$RESOURCE_DIR" run deploy

编辑:好的,看起来Firebase需要一个lint脚本。所以只需将"lint": ""添加到脚本中。

xqk2d5yq

xqk2d5yq2#

the linter package isn't installed , if you need to deploy without run linter you can remove the those lines from firebase.json file

"predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint"
    ],
t9eec4r0

t9eec4r03#

我在部署用typescript编写的firebase云函数时遇到了同样的错误。在package.json下,我添加了以下行。然后函数成功部署。
在脚本下-〉

"lint": "tslint --project tsconfig.json",

在devDependencies下-〉

"tslint": "^5.12.0",
nmpmafwu

nmpmafwu4#

尝试将firebase.json文件中的$RESOURCE_DIR替换为%RESOURCE_DIR%。

相关问题