0

我正在使用 部署 node.js 应用程序firebase-functions,但是在运行命令时firebase deploy出现以下错误:

13 在 f (/home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/once/once.js:25:25) 在 afterExtras (/home/shubhamg931/.nvm/versions /node/v8.4.0/lib/node_modules/npm/lib/config/core.js:178:20)在Conf。(/home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/config/core.js:234:20) 在/home/shubhamg931/.nvm/versions/node/v8。 4.0/lib/node_modules/npm/lib/config/set-user.js:23:20 在/home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/mkdirp/index。 js:47:53 at /home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:284:29 at FSReqWrap.oncomplete (fs.js: 152:21) /home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/utils/error-handler.js:205 如果 (npm.

TypeError:无法读取 process.errorHandler 中未定义的属性“get”(/home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/utils/error-handler.js:205:17 ) 在emitOne (events.js:115:13) 在process.emit (events.js:210:7) 在process._fatalException (bootstrap_node.js:349:26)

错误:功能预部署错误:命令以非零退出代码7终止

以下是我的 Firebase 配置文件(又名firebase.json):

{
  "database": {
    "rules": "database.rules.json"
  },
  "functions": {
    "predeploy": [
      "npm --prefix $RESOURCE_DIR run lint"
    ],
    "source": "functions"
  },
  "hosting": {
    "public": "public",
    "rewrites": [{
        "source": "**",
        "functions": "app"
      }],
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

以下是我的index.js文件:

const functions = require('firebase-functions');
var express = require("express"),
app = express(),
bodyParser = require("body-parser");

app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({extended: true}));
app.use(express.static("public"));

app.get("/", function(req,res){
  res.render("index");
});

app.get("/about", function(req,res){
  console.log("ABOUT");
  res.render("about");
});

app.get("/corporate", function(req,res){
  console.log("CORPORATE");
  res.render("corporate");
});

app.get("/weddings", function(req,res){
  console.log("WEDDINGS");
  res.render("wedding");
});

app.get("/parties", function(req,res){
  console.log("PARTIES");
  res.render("parties");
});

app.get("/contact", function(req,res){
  console.log("CONTACT");
  res.render("contact");
});

app.get("/detail", function(req,res){
    console.log("DETAIL PAGE");
    res.render("detail");
});

// app.listen(8000, function(req,res){
//   console.log("started server! :)");
// });

// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions

exports.app = functions.https.onRequest(app);

我尝试安装nvm然后重新安装,firebase-tools但这对我不起作用。

我是新手firebase-tools。任何帮助,将不胜感激。

4

0 回答 0