9

I having problem of deploying Firebase Cloud Functions.

Steps to reproduce

  • firebase init
  • select function only
  • select Firebase Project
  • select Javascript
  • use ESLint
  • install dependencies with npm now
  • Run firebase deploy

Expected Result

Expecting firebase-tools to deploy the cloud functions.

Actual Result

Receive the following error message:

λ firebase deploy

=== Deploying to '<projects>'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
npm ERR! path ...path\firebaseFunction\%RESOURCE_DIR%\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '...path\firebaseFunction\%RESOURCE_DIR%\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     ...path\AppData\Roaming\npm-cache\_logs\2018-06-17T10_02_45_577Z-debug.log

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

I have tried googled it and follow the solutions on below link but it doesn't work to me: https://github.com/firebase/firebase-tools/issues/610

Please help!

Thank you.

Jerry
  • 1,455
  • 1
  • 18
  • 39

6 Answers6

17

Try replacing the string "$RESOURCE_DIR" with "%RESOURCE_DIR%" in your "firebase.json" file.

Now run the deploy command again. It worked for me.

Explanation: This fix is for Windows because %RESOURCE_DIR% will be recognized as an environment variable only by Windows command-line interpreters. As an ultimate consequence, the project isn't cross-platform anymore, as mentioned in the answer of this similar question.

normanius
  • 8,629
  • 7
  • 53
  • 83
Osama
  • 456
  • 4
  • 15
3

1. In firebase.json file

try and replace $RESOURCE_DIRwith %RESOURCE_DIR% and

"npm --prefix $RESOURCE_DIR run lint" to "npm --prefix %RESOURCE_DIR% run lint"

(the above one just worked around )

2. npm install -g git://github.com/firebase/firebase-tools#master

please try this installation again in ur project folder it should solve the issue

Hari_pb
  • 7,088
  • 3
  • 45
  • 53
Jaideep
  • 908
  • 8
  • 22
2

I had the same problem just remove the predeploy from firebase.json file and it will work fine

1

It looks like you're either using an old version of the Firebase CLI, or a project that was initialized with an old version. The cleanest thing to do would be to upgrade your CLI:

npm install -g firebase-tools

And create a whole new project from scratch with firebase init. Then, reconstruct your new project with the code from the old project.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
0

Solution

"functions": {
  "predeploy": [
    "npm --prefix \"$RESOURCE_DIR\" run lint",
    "npm --prefix \"$RESOURCE_DIR\" run build"
  ]
}

to

"functions": {
  "predeploy": [
    "npm --prefix \"%RESOURCE_DIR%\" run lint",
    "npm --prefix \"%RESOURCE_DIR%\" run build"
  ]
}
David Buck
  • 3,752
  • 35
  • 31
  • 35
-1

Step1: open firebase.json you will show this JSON file

"functions": { "predeploy": [ "npm --prefix \"$RESOURCE_DIR\" run lint", "npm --prefix \"$RESOURCE_DIR\" run build" ] }

Step2: Delete "npm --prefix \"$RESOURCE_DIR\" run lint", and "npm --prefix \"$RESOURCE_DIR\" run build"

"functions": { "predeploy": [] }

Now deploy, it works fine

Deep Nishad
  • 181
  • 1
  • 2
  • 7