Following the firebase function getting started guide and getting a seemingly simple error once trying to deploy with:
firebase deploy --only functions
i deploying functions
Running command: npm --prefix $RESOURCE_DIR run lint
npm ERR! path C:\Users\Beat\leginformant\$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
'C:\Users\Beat\leginformant\$RESOURCE_DIR\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
The package.json file does exist just as the tutorial shows in my project/functions/package.json. Have tried changing or printing out the RESOURCE_DIR env with no success. Assuming it would be scoped inside of the NPM shell environment.
npm version: 5.6.0
node version: 8.9.0
As an extra doing npm --prefix %RESOURCE_DIR% run lint like @Deji James said, made me some progress but still didn't work.
As a suggestion I found this https://github.com/firebase/firebase-tools/issues/610
and @merlinnot says here Hey guys, you all probably have sth in your predeploy in firebase.json, don't you? Just delete what you have there for now if it's not that important.
worked for me. PS. before deciding to delete, I have done all reinstall things, uninstall things. Only this is worked.
You can fix this by accessing your
firebase.json
file and delete this line containingRESOURCE_DIR
.Apart from the other suggestions, if you change the preflight/predeploy command from:
to
the issue seems to get fixed. This also resolves it for both Windows and Linux.
To see more details, please see this answer (and further thread): https://github.com/firebase/firebase-tools/issues/610#issuecomment-360147507
In windows, while Initializing the firebase Project in CLI using
firebase init
,Infirebase.json
file,Change the code to as per below{ "functions": { "predeploy": [ "npm --prefix \"%RESOURCE_DIR%\" run lint" ], "source": "functions" } }
After this change, tryfirebase deploy --only functions
command.When running
I use this configuration
Then if use windows
Replace $RESOURCE_DIR by %RESOURCE_DIR% in firebase.json
You have to change
firebase.json
file as shown in here