ESLint error while trying to deploy firebase functions

eslint firebase functions
firebase deploy functions
functions predeploy error: command terminated with non-zero exit code1
running command: npm --prefix "$resource_dir" run lint
firebase-functions initializeapp
npm install firebase-functions
npm err! missing script: lint
firebase-functions is not a function

I tried deploying a firebase functions but it keeps failing due to some issue with ESLint. I have also tried googling the answer but everything I am seeing is all Greek to me.

I have also stumbled on this and this answer but it appears they're not applicable to my scenario.

My Function
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
// exports.helloWorld = functions.https.onRequest((request, response) => {
//  response.send("Hello from Firebase!");
// });


//import firebase functions modules
const functions = require("firebase-functions");
//import admin module
const admin = require("firebase-admin");
admin.initializeApp(functions.config().firebase);

// Listens for new messages added to messages/:pushId
exports.pushNotification = functions.database.ref("/Message").onWrite( event => {
    //  Grab the current value of what was written to the Realtime Database.
    var valueObject = event.data.val();
    // Log the event
    console.log("Push notification event triggered for " + valueObject.title);

    //if(valueObject.title != null) {
      //valueObject.photoUrl= "Sent you a photo!";
   // }

  // Create a notification
    const payload = {
        data: {
            body:valueObject.body,
            imgUrl: valueObject.imgUrl,
            postUrl: valueObject.postUrl,
            title: valueObject.title
        },
    };

  //Create an options object that contains the time to live for the notification and the priority
    const options = {
        priority: "high",
        timeToLive: 60 * 60 * 24
    };


    return admin.messaging().sendToTopic("Posts", payload, options);
});
Log
0 info it worked if it ends with ok
1 verbose cli [ '/home/xoxo/.nvm/versions/node/v9.5.0/bin/node',
1 verbose cli   '/home/xoxo/.nvm/versions/node/v9.5.0/bin/npm',
1 verbose cli   '--prefix',
1 verbose cli   '/home/xoxo/Android/Projects/FirebaseFunctions/functions',
1 verbose cli   'run',
1 verbose cli   'lint' ]
2 info using npm@5.6.0
3 info using node@v9.5.0
4 verbose run-script [ 'prelint', 'lint', 'postlint' ]
5 info lifecycle functions@~prelint: functions@
6 info lifecycle functions@~lint: functions@
7 verbose lifecycle functions@~lint: unsafe-perm in lifecycle true
8 verbose lifecycle functions@~lint: PATH: /home/xoxo/.nvm/versions/node/v9.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/xoxo/Android/Projects/FirebaseFunctions/functions/node_modules/.bin:/home/xoxo/.nvm/versions/node/v9.5.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
9 verbose lifecycle functions@~lint: CWD: /home/xoxo/Android/Projects/FirebaseFunctions/functions
10 silly lifecycle functions@~lint: Args: [ '-c', 'eslint .' ]
11 info lifecycle functions@~lint: Failed to exec lint script
12 verbose stack Error: functions@ lint: `eslint .`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (/home/xoxo/.nvm/versions/node/v9.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:160:13)
12 verbose stack     at maybeClose (internal/child_process.js:943:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
13 verbose pkgid functions@
14 verbose cwd /home/xoxo/Android/Projects/FirebaseFunctions
15 verbose Linux 4.13.0-32-generic
16 verbose argv "/home/xoxo/.nvm/versions/node/v9.5.0/bin/node" "/home/xoxo/.nvm/versions/node/v9.5.0/bin/npm" "--prefix" "/home/xoxo/Android/Projects/FirebaseFunctions/functions" "run" "lint"
17 verbose node v9.5.0
18 verbose npm  v5.6.0
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error functions@ lint: `eslint .`
23 error spawn ENOENT
24 error Failed at the functions@ lint script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
Console Output
xoxo@xo9:~/Android/Projects/FirebaseFunctions$ firebase deploy

=== Deploying to 'testproject-a1bda'...

i  deploying functions
Running command: npm --prefix $RESOURCE_DIR run lint

> functions@ lint /home/xoxo/Android/Projects/FirebaseFunctions/functions
> eslint .

sh: 1: eslint: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! functions@ lint: `eslint .`
npm ERR! spawn ENOENT
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 WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xoxo/.npm/_logs/2018-02-03T22_35_55_608Z-debug.log

Error: functions predeploy error: Command terminated with non-zero exit code1
Package.js
{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "./node_modules/.bin/eslint .",
    "serve": "firebase serve --only functions",
    "shell": "firebase experimental:functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "dependencies": {
    "firebase-admin": "~5.8.1",
    "firebase-functions": "^0.8.1"
  },
  "devDependencies": {
    "eslint": "^4.12.0",
    "eslint-plugin-promise": "^3.6.0"
  },
  "private": true
}

Please what am I doing wrong?

The only way I can imagine that your project got into this state is if you refused to allow npm to install dependencies at the time of project creation. So when you asks you this:

? Do you want to install dependencies with npm now?

You may have answered 'No'. This would prevent the eslint package from being installed, and you would see that error.

Otherwise, you may have deleted the eslint installed package under node_modules somehow. You can run npm install from the functions folder to recreate everything needed under node_modules.

ESLint error trying to deploy functions Firebase, Error: functions predeploy error: Command terminated with non-zero exit code1. i tried installing splint via homebrew, but the lint error persists. that there is a ' node_modules' folder in both. i checked them both for eslint. javascript - ESLint error trying to deploy functions Firebase - Stack Overflow I'm try to deploy fireabase example, but when I try to deploy it, CLI launches an error: [CODE] const functions = require('firebase-functions'); //to activate firebase functions const admin =

Had the same problem I reinstalled npm

npm install npm -g

then reinitiated the Firebase functions (you have to overwrite all files and make sure to install EsLine the debugging and install all dependencies ) yes press Y for any request

Firebase init functions

and everything worked just fine after deploying again

Firebase deploy

still running into issues with firebase deploy now lint is missing , I tried deploying a firebase functions but it keeps failing due to some issue with ESLint. I have also tried googling the answer but everything I am seeing is all� I’m currently trying to setup CI through GitLab for my React app hosted on Firebase. I’m struggling to get past this point. There were some other post suggesting the use of sudo but the console told me the command was not found. This is my first attempt at CICD so any help or resources on this particular stack would be greatly appreciated. Thanks you. Not sure if helpful, but the job

hey you just need to return something from then statement

let params = {...};
var firestore = admin.firestore();
var dbRef = firestore.collection('your-collection-name');

dbRef.add(params)
     .then((docRef) => {
       console.log("doc added with ID ", docRef.id);

       return null
     })
     .catch((err) => {
       console.error("Error in adding document ", err);
     });

ESLint error while trying to deploy firebase functions, i am trying to deploy my function to the firebase but when ever i execute firebase deploy i do get the error. C:\Users\vimiv>firebase deploy === Deploying to� Collection of sample apps showcasing popular use cases using Cloud Functions for Firebase - firebase/functions-samples

If you found -prefix "%REASOURCE_DIR%" run init type error while deploying firebase project, then you have to edit some code in firebase.json file. Here is an Example

error code ELIFECYCLE errno 1 error functions# lint: `eslint .` while , I'm currently trying to setup CI through GitLab for my React app "eslint: Permission denied" when deploying React app on Firebase through GitLab Error: functions predeploy error: Command terminated with non-zero exit� > eslint . functions: Finished running predeploy script. i functions: ensuring necessary APIs are enabled functions: all necessary APIs are enabled i functions: preparing functions directory for uploading i functions: packaged functions (56.39 KB) for uploading functions: functions folder uploaded successfully i functions: updating

I had a similar error appear. I found out that my directory that held the firebase project was named firebase/database. I removed the / and made the directory name firebase-database. Hopefully that helps someone.

"eslint: Permission denied" when deploying React app on Firebase , Deploy to Cloud Functions for Firebase; Connect the webhook to your Action If the following command fails with an EACCES error, you may need to Choose if you want to use ESLint to catch probable bugs and enforce� To deploy functions, run this Firebase CLI command: $ firebase deploy --only functions If you encounter permissions errors when deploying functions, make sure that the appropriate IAM roles are

Deploy fulfillment, To get started with Cloud Functions, try working through this tutorial, which tasks and works through creating, testing, and deploying two related functions: If you encounter access errors such as "Unable to authorize access to project," try � The Firebase team released firebase-functions@3.7.0 to provide enhanced structured logging for node 10 runtimes. So, now you can write code like this, passing arbitrary objects to new log functions:

Get started: write, test, and deploy your first functions, ESLint error while trying to deploy firebase functions, 23 error spawn ENOENT 24 error Failed at the functions@ lint script. 24 error This is probably not a� firebase deploy --only functions After you deploy, depending upon the trigger, for me it was function.https.onRequest so I get a URL, you can get the URL through the console as well. Back to my

Firebase deploy errors starting with non-zero exit code (space in , 问题: I need some help with async function with firebase and node.js I the function in index.js to wait the result in biglietti.js but when I'm trying to use the async / await i keep getting: deploying functions Running command: npm --prefix ELIFECYCLE npm ERR! errno 1 npm ERR! functions@ lint: `eslint . hello, teacher ! i have an issue when i am trying to deploy a function witch is in index.js file, a take all your code witch your publish to github for notification, but i have this issue:warning n

Comments
  • Please show the normal console output from firebase deploy instead of this debug output from npm.
  • @DougStevenson, Thanks. Please I have added it
  • It looks like you asked the Firebase CLI to check your code with ESLint, but then managed to somehow not install it, or uninstall it. What's your package.json look like?
  • Actually, if you could verify the exact steps you took to set up a project that behaves this way, that would be immensely helpful.
  • @DougStevenson I have added the content of package.js
  • FYI I just received this error by duplicating my project into a new directory. None-the-less navigating to functions and running rm -rf node_modules/ && npm install and npm cache clean --force as suggested fixed it. Thank you!
  • Perfectly worked for me, I think for ESLint dependencies was missing,
  • what's the side effect of removing this eslint ?