部署时 npm err 缺少脚本 lint

rak*_*tel 1 node.js npm

运行以下命令时:

npm --prefix "$RESOURCE_DIR" run lint
Run Code Online (Sandbox Code Playgroud)

它返回以下错误:

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

这是我的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
}
Run Code Online (Sandbox Code Playgroud)

whi*_*fin 6

您正在尝试运行该lint任务,但它不存在于您的包定义中。您确定不想运行以下内容吗(根据您的问题标题)?

npm --prefix "$RESOURCE_DIR" run deploy
Run Code Online (Sandbox Code Playgroud)

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