0

I am deploying a node.js application using firebase-functions, but when I am running the command firebase deploy I get the following error:

Running command: npm --prefix $RESOURCE_DIR run lint Error: EACCES: permission denied, mkdir '/media/shubhamg931/New' TypeError: Cannot read property 'get' of undefined at errorHandler (/home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/utils/error-handler.js:205:17) at /home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/bin/npm-cli.js:83:20 at cb (/home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/npm.js:224:22) at /home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/npm.js:262:24 at /home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/config/core.js:81:7 at Array.forEach () at /home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/config/core.js:80:13 at f (/home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/once/once.js:25:25) at afterExtras (/home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/config/core.js:178:20) at Conf. (/home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/config/core.js:234:20) at /home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/config/set-user.js:23:20 at /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 if (npm.config.get('json')) { ^

TypeError: Cannot read property 'get' of undefined at process.errorHandler (/home/shubhamg931/.nvm/versions/node/v8.4.0/lib/node_modules/npm/lib/utils/error-handler.js:205:17) at emitOne (events.js:115:13) at process.emit (events.js:210:7) at process._fatalException (bootstrap_node.js:349:26)

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

Following is my Firebase configuration file (aka 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/**"
    ]
  }
}

And the following is my index.js file:

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);

I have tried to install nvm and then reinstall firebase-tools but that did not work for me.

I am new to firebase-tools. Any help would be appreciated.

Edric
  • 24,639
  • 13
  • 81
  • 91
Shubham Gupta
  • 414
  • 7
  • 19

0 Answers0