firebase - 错误代码 ELIFECYCLE errno 1 错误函数@ lint: `eslint .` 在部署 firebase 时
问题描述
我正在尝试将我的功能部署到火力基地,但是当我执行时
firebase deploy
我确实得到了错误。
C:\Users\vimiv>firebase deploy
=== Deploying to 'touch-keeper'...
i deploying functions, hosting
Running command: npm --prefix "%RESOURCE_DIR%" run lint
> functions@ lint C:\Users\vimiv\functions
> eslint .
module.js:549
throw err;
^
Error: Cannot find module 'wordwrap'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\vimiv\functions\node_modules\optionator\lib\help.js:6:14)
at Object.<anonymous> (C:\Users\vimiv\functions\node_modules\optionator\lib\help.js:247:4)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\vimiv\AppData\Roaming\npm-cache\_logs\2018-08-
17T10_47_41_587Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code1
这是我的 index.js
'use-strict'
const admin = require('firebase-admin');
const functions = require('firebase-functions');
admin.initializeApp(functions.config().firebase);
exports.sendMessageNotification = functions.database.ref('DR/MELTING/{itemname}').onWrite(event => {
//const itemname = event.params.itemname;
console.log("Notificatiion Triggered Successfuly");
});
这是我的 package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"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": "^6.0.0",
"firebase-functions": "^2.0.5",
"prelude-ls": "^1.1.2",
"word-wrap": "^1.2.3"
},
"devDependencies": {
"eslint": "^4.12.0",
"eslint-plugin-promise": "^3.6.0"
},
"private": true
}
我也改变了我的 firebase.json 前缀命令
解决方案
您需要安装您可能在函数中使用的任何依赖项。npm install
在您的函数文件夹中运行。
推荐阅读
- vue.js - 允许 html/markdown 在 VuePress 中作为页脚
- css - 滑块内的图像封面
- java - Spring - applicationContext getBeansWithAnnotation 方法返回一个空列表
- javascript - 为什么状态不改变?
- java - 如何转换 ArrayList
向量 对于 JNI? - ruby-on-rails - 不知从何处获取“ActiveRecord::RecordNotFound in PostsController#show”
- python - nginx loadbalancer conf文件解析python
- c# - 如何在一条垂直线上生成所有值而不重复“\t”或“\n”?
- php - Php从印度格式的购买日期计算到期日期
- python - 每分钟调用相同的 API 超过 2000 次(JSON/PYTHON),使用(HTTP 同步、HTTP 异步、Websocket 或其他)?