Cloud Functions deploy error during lint on Windows: “enoent ENOENT: no such file or directory”

后端 未结 9 2423
轻奢々
轻奢々 2020-11-27 07:07

Following the firebase function getting started guide and getting a seemingly simple error once trying to deploy with:

firebase deploy --only functions

i  d         


        
相关标签:
9条回答
  • 2020-11-27 07:40

    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.

    0 讨论(0)
  • 2020-11-27 07:41

    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"
      }
    }
    
    0 讨论(0)
  • 2020-11-27 07:45

    You can fix this by accessing your firebase.json file and delete this line containing RESOURCE_DIR.

    0 讨论(0)
  • 2020-11-27 07:50

    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.

    0 讨论(0)
  • 2020-11-27 07:50

    You have to change firebase.json file as shown in here

    "npm --prefix functions run lint"
    "npm --prefix functions run build"
    
    0 讨论(0)
  • 2020-11-27 07:52

    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

    0 讨论(0)
提交回复
热议问题