Following the firebase function getting started guide and getting a seemingly simple error once trying to deploy with:
firebase deploy --only functions
i d
In windows, while Initializing the firebase Project in CLI using firebase init
,In firebase.json
file,Change the code to as per below{
"functions": {
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint"
],
"source": "functions"
}
}
After this change, try firebase deploy --only functions
command.
Change the following:
npm --prefix \"$RESOURCE_DIR\" run lint
to
npm --prefix \"%RESOURCE_DIR%\" run lint
in firebase.json file in main structure
{
"functions": {
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint"
],
"source": "functions"
}
}
You can fix this by accessing your firebase.json
file and delete this line containing RESOURCE_DIR
.
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 have to change firebase.json
file as shown in here
"npm --prefix functions run lint"
"npm --prefix functions run build"
Apart from the other suggestions, if you change the preflight/predeploy command from:
"npm --prefix \"$RESOURCE_DIR\" run lint", OR
"npm --prefix \"%RESOURCE_DIR%\" run lint"
to
"npm --prefix ./functions run lint"
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