firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.01k stars 925 forks source link

predeploy hook cannot execute rmdir on Windows cmd #1650

Open xenogew opened 5 years ago

xenogew commented 5 years ago

[REQUIRED] Environment info

firebase-tools: 7.3.1

Platform: Windows 10 v1903 build 18362.329

[REQUIRED] Test case

Define this in firebase.json and call firebase deploy

{
  "functions": {
    "source": "functions",
    "predeploy": [
      "npm --prefix src run build && rmdir /s /q functions/nuxt && cp -r src/_nuxt/ functions/nuxt/ && cp src/nuxt.config.js functions/"
    ]
  },
  "hosting": {
    "predeploy": [
      "rmdir /s /q public/* && mkdir -p public/_nuxt && cp -r src/nuxt/dist/client/ public/_nuxt && cp -a src/static/. public/"
    ],
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "function": "ssrapp"
      }
    ]
  }
}

[REQUIRED] Steps to reproduce

"rmdir public/* && mkdir -p public/_nuxt" in predeploy hook always return error. The other that I had tried.

[REQUIRED] Expected behavior

One of those commands should be executed without error. At least rmdir /s /q of CMD

[REQUIRED] Actual behavior

Running command: rmdir /s /q functions/nuxt && cp -r src/.nuxt/ functions/nuxt/ && cp src/nuxt.config.js functions/
The specific file path was not found
The specific file path was not found
The specific file path was not found

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

Log with --debug flag

PS C:\sandbox\firebase-ssr-app> firebase deploy --debug
[2019-09-10T04:45:27.652Z] ----------------------------------------------------------------------
[2019-09-10T04:45:27.655Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\wanga\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js deploy --debug
[2019-09-10T04:45:27.656Z] CLI Version:   7.3.1
[2019-09-10T04:45:27.656Z] Platform:      win32
[2019-09-10T04:45:27.656Z] Node Version:  v12.9.1
[2019-09-10T04:45:27.657Z] Time:          Tue Sep 10 2019 13:45:27 GMT+0900 (GMT+09:00)
[2019-09-10T04:45:27.658Z] ----------------------------------------------------------------------

[2019-09-10T04:45:27.668Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-09-10T04:45:27.669Z] > authorizing via signed-in user
[2019-09-10T04:45:27.669Z] [iam] checking project fir-ssr-nuxt-57e34 for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get","firebasehosting.sites.update"]
[2019-09-10T04:45:27.671Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/fir-ssr-nuxt-57e34:testIamPermissions  
 permissions=[cloudfunctions.functions.create, cloudfunctions.functions.delete, cloudfunctions.functions.get, cloudfunctions.functions.list, cloudfunctions.functions.update, cloudfunctions.operations.get, firebase.projects.get, firebasehosting.sites.update]
[2019-09-10T04:45:28.520Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Tue, 10 Sep 2019 04:45:27 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=656, alt-svc=quic=":443"; ma=2592000; v="46,43,39", accept-ranges=none, transfer-encoding=chunked
[2019-09-10T04:45:28.524Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/fir-ssr-nuxt-57e34

[2019-09-10T04:45:29.254Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Tue, 10 Sep 2019 04:45:28 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43,39", accept-ranges=none, transfer-encoding=chunked

=== Deploying to 'fir-ssr-nuxt-57e34'...

i  deploying functions, hosting
Running command: npm --prefix src run build

> firebase-ssr-app@1.0.0 build C:\sandbox\firebase-ssr-app\src
> nuxt build

i Production build                                                                                                                                                                 13:45:34
√ Builder initialized                                                                                                                                                              13:45:34
√ Nuxt files generated                                                                                                                                                             13:45:34

√ Client
  Compiled successfully in 5.75s

√ Server
  Compiled successfully in 1.74s

Hash: 54541c9d3fa9f0920923
Version: webpack 4.39.3
Time: 5755ms
Built at: 2019-09-10 13:45:42
                         Asset       Size  Chunks             Chunk Names
../server/client.manifest.json   7.51 KiB          [emitted]
       85158a42fecda069d42a.js    163 KiB       1  [emitted]  commons.app
       991b5a7aa343a5b6cdcc.js    194 KiB       4  [emitted]  vendors.app
                      LICENSES  510 bytes          [emitted]
       c32322ce54a1a414d879.js   2.31 KiB       3  [emitted]  runtime
       f88cae097bb9ae23cc48.js   37.5 KiB       0  [emitted]  app
       fa98c0f377e46d3063de.js   3.61 KiB       2  [emitted]  pages_index
 + 2 hidden assets
Entrypoint app = c32322ce54a1a414d879.js 85158a42fecda069d42a.js 991b5a7aa343a5b6cdcc.js f88cae097bb9ae23cc48.js

Hash: 3f3df7d2f4f5a3fa767f
Version: webpack 4.39.3
Time: 1737ms
Built at: 2019-09-10 13:45:43
                  Asset       Size  Chunks             Chunk Names
7e204b422f5271e97dfd.js   3.67 KiB       1  [emitted]  pages_index
              server.js    212 KiB       0  [emitted]  app
   server.manifest.json  243 bytes          [emitted]
 + 2 hidden assets
Entrypoint app = server.js server.js.map
Running command: rmdir /s /q functions/nuxt && cp -r src/.nuxt/ functions/nuxt/ && cp src/nuxt.config.js functions/
指定されたファイルが見つかりません。
指定されたファイルが見つかりません。
指定されたファイルが見つかりません。

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

Having trouble? Try firebase deploy --help
google-oss-bot commented 5 years ago

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.