Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Function Deployment issue: package.json not found in %RESOURCE_DIR%

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.

like image 278
Jerry Avatar asked Jun 17 '18 10:06

Jerry


2 Answers

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.

like image 62
Osama Avatar answered Oct 10 '22 16:10

Osama


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

like image 39
jaideep Avatar answered Oct 10 '22 14:10

jaideep