无法将 node.js 应用部署到 google 云应用引擎

Unable to deploy node.js app to google cloud app engine

我有一个 API 部署到 google 云应用引擎正常工作。我昨天(11 月 26 日)成功部署,一切顺利。

但是今天,没有更改我的 app.yaml 文件或安装任何新的依赖项(我的 package.jsonpackage-lock.json 是一样的),我无法再部署它了。

错误消息对我没有帮助,我不知道这个错误是从哪里来的(gcloud app deploy 之后的错误):

starting build "0e9f3841-1627-44b2-92f1-97745eb6b73f"

FETCHSOURCE
BUILD
Starting Step #0 - "fetcher"
Step #0 - "fetcher": Already have image (with digest): gcr.io/cloud-builders/gcs-fetcher
Step #0 - "fetcher": Fetching manifest gs://staging.emcantomeu-api.appspot.com/ae/60a880db-d388-4db3-9bef-9d233841ff13/manifest.json.
Step #0 - "fetcher": Processing 82 files.
Step #0 - "fetcher": ******************************************************
Step #0 - "fetcher": Status: SUCCESS
Step #0 - "fetcher": Started: 2018-11-27T18:06:20Z
Step #0 - "fetcher": Completed: 2018-11-27T18:06:23Z
Step #0 - "fetcher": Requested workers: 200
Step #0 - "fetcher": Actual workers: 82
Step #0 - "fetcher": Total files: 82
Step #0 - "fetcher": Total retries: 2
Step #0 - "fetcher": GCS timeouts: 2
Step #0 - "fetcher": MiB downloaded: 7.75 MiB
Step #0 - "fetcher": MiB/s throughput: 3.40 MiB/s
Step #0 - "fetcher": Time for manifest: 864.31 ms
Step #0 - "fetcher": Total time: 3.15 s
Step #0 - "fetcher": ******************************************************
Finished Step #0 - "fetcher"
Starting Step #1 - "builder"
Step #1 - "builder": Pulling image: gcr.io/gae-runtimes/nodejs10_app_builder:nodejs10_10_13_0_20181111_RC00
Step #1 - "builder": nodejs10_10_13_0_20181111_RC00: Pulling from gae-runtimes/nodejs10_app_builder
Step #1 - "builder": Digest: sha256:dcaad09757154246bebf1c802bb43b7002301409d9261ad21faa1864a9138d69
Step #1 - "builder": Status: Downloaded newer image for gcr.io/gae-runtimes/nodejs10_app_builder:nodejs10_10_13_0_20181111_RC00
Step #1 - "builder": INFO FTL version node-v0.11.0
Step #1 - "builder": INFO Beginning FTL build for node
Step #1 - "builder": INFO FTL arg passed: exposed_ports None
Step #1 - "builder": INFO FTL arg passed: cache_repository us.gcr.io/emcantomeu-api/app-engine-tmp/build-cache/ttl-7d
Step #1 - "builder": INFO FTL arg passed: tar_base_image_path None
Step #1 - "builder": INFO FTL arg passed: builder_output_path /builder/outputs
Step #1 - "builder": INFO FTL arg passed: name us.gcr.io/emcantomeu-api/app-engine-tmp/app/ttl-2h:60a880db-d388-4db3-9bef-9d233841ff13
Step #1 - "builder": INFO FTL arg passed: ttl 168
Step #1 - "builder": INFO FTL arg passed: global_cache False
Step #1 - "builder": INFO FTL arg passed: cache True
Step #1 - "builder": INFO FTL arg passed: upload True
Step #1 - "builder": INFO FTL arg passed: sh_c_prefix False
Step #1 - "builder": INFO FTL arg passed: fail_on_error True
Step #1 - "builder": INFO FTL arg passed: base gcr.io/gae-runtimes/nodejs10:nodejs10_10_13_0_20181111_RC00
Step #1 - "builder": INFO FTL arg passed: output_path None
Step #1 - "builder": INFO FTL arg passed: cache_key_version v0.11.0
Step #1 - "builder": INFO FTL arg passed: cache_salt 
Step #1 - "builder": INFO FTL arg passed: directory /workspace
Step #1 - "builder": INFO FTL arg passed: entrypoint None
Step #1 - "builder": INFO FTL arg passed: additional_directory None
Step #1 - "builder": INFO FTL arg passed: destination_path /srv
Step #1 - "builder": INFO FTL arg passed: verbosity NOTSET
Step #1 - "builder": INFO starting: full build
Step #1 - "builder": INFO starting: builder initialization
Step #1 - "builder": INFO Loading Docker credentials for repository 'gcr.io/gae-runtimes/nodejs10:nodejs10_10_13_0_20181111_RC00'
Step #1 - "builder": INFO Loading Docker credentials for repository 'us.gcr.io/emcantomeu-api/app-engine-tmp/app/ttl-2h:60a880db-d388-4db3-9bef-9d233841ff13'
Step #1 - "builder": INFO builder initialization took 0 seconds
Step #1 - "builder": INFO starting: build process for FTL image
Step #1 - "builder": INFO starting: rm_node_modules
Step #1 - "builder": INFO rm_node_modules rm -rf /workspace/node_modules
Step #1 - "builder": INFO `rm_node_modules` stdout:
Step #1 - "builder": 
Step #1 - "builder": INFO rm_node_modules took 0 seconds
Step #1 - "builder": INFO starting: checking_cached_packages_json_layer
Step #1 - "builder": DEBUG Checking cache for cache_key e21be12699e5e087245dc8e246f7a17e1d5571d3c7dc004195afa63b46b39fc9
Step #1 - "builder": INFO No cached base image found for entry: us.gcr.io/emcantomeu-api/app-engine-tmp/build-cache/ttl-7d/node-cache:e21be12699e5e087245dc8e246f7a17e1d5571d3c7dc004195afa63b46b39fc9.
Step #1 - "builder": INFO Cache miss on local cache for us.gcr.io/emcantomeu-api/app-engine-tmp/build-cache/ttl-7d/node-cache:e21be12699e5e087245dc8e246f7a17e1d5571d3c7dc004195afa63b46b39fc9
Step #1 - "builder": INFO No cached dependency layer for e21be12699e5e087245dc8e246f7a17e1d5571d3c7dc004195afa63b46b39fc9
Step #1 - "builder": INFO [CACHE][MISS] v0.11.0:NODE->e21be12699e5e087245dc8e246f7a17e1d5571d3c7dc004195afa63b46b39fc9
Step #1 - "builder": INFO checking_cached_packages_json_layer took 0 seconds
Step #1 - "builder": INFO starting: building_packages_json_layer
Step #1 - "builder": INFO starting: npm_install
Step #1 - "builder": INFO npm_install npm install --production
Step #1 - "builder": INFO `npm_install` stdout:
Step #1 - "builder": 
Step #1 - "builder": INFO `npm_install` had stderr output:


Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/empower-core-17c5c138/package.json'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/empower-core-17c5c138/CHANGELOG.md'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/empower-core-17c5c138/index.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/empower-core-17c5c138/README.md'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/each.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/constant.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/eachRight.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/conforms.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/endsWith.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/cond.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/entries.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/protobufjs-5cf86b95/dist/light/README.md'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/concat.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/bluebird-e8847f49/js/browser/bluebird.min.js'

....
....
....

Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/fsevents-355423a2/node_modules/iconv-lite/encodings/tables/shiftjis.json'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, lstat '/workspace/node_modules/.staging/google-proto-files-4307fece/google/iam/v1/logging'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/google-proto-files-4307fece/google/iam/v1/policy.proto'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, lstat '/workspace/node_modules/.staging/google-proto-files-4307fece/google/logging'
Step #1 - "builder": npm WARN platform-api@1.0.0 No repository field.
Step #1 - "builder": 
Step #1 - "builder": npm ERR! code E404
Step #1 - "builder": npm ERR! 404 Not Found: flatmap-stream@0.1.1
Step #1 - "builder": 
Step #1 - "builder": npm ERR! A complete log of this run can be found in:
Step #1 - "builder": npm ERR! /builder/home/.npm/_logs/2018-11-27T18_06_41_641Z-debug.log
Step #1 - "builder": 
Step #1 - "builder": ERROR error: `npm_install` returned code: 1
Step #1 - "builder": INFO npm_install took 15 seconds
Step #1 - "builder": INFO building_packages_json_layer took 15 seconds
Step #1 - "builder": INFO build process for FTL image took 15 seconds
Step #1 - "builder": INFO full build took 15 seconds
Step #1 - "builder": ERROR `npm_install` had stderr output:


Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/empower-core-17c5c138/package.json'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/empower-core-17c5c138/CHANGELOG.md'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/empower-core-17c5c138/index.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/empower-core-17c5c138/README.md'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/each.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/constant.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/eachRight.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/conforms.js'
Step #1 - "builder": npm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/lodash-321678b3/endsWith.js'

Step #1 - "builder": npm WARN platform-api@1.0.0 No repository field.
Step #1 - "builder": 
Step #1 - "builder": npm ERR! code E404
Step #1 - "builder": npm ERR! 404 Not Found: flatmap-stream@0.1.1
Step #1 - "builder": 
Step #1 - "builder": npm ERR! A complete log of this run can be found in:
Step #1 - "builder": npm ERR! /builder/home/.npm/_logs/2018-11-27T18_06_41_641Z-debug.log
Step #1 - "builder": 
Step #1 - "builder": error: `npm_install` returned code: 1
Finished Step #1 - "builder"
ERROR
ERROR: build step 1 "gcr.io/gae-runtimes/nodejs10_app_builder:nodejs10_10_13_0_20181111_RC00" failed: exit status 1

app.yaml 文件:

runtime: nodejs8

p.s 1:我已正确验证 (gcloud auth login)。

p.s 2:我正在使用正确的项目 (gcloud config set project <MY_PROJECT_ID>)

p.s 3:我已经创建了一个新的 gcloud 项目,当我尝试部署时遇到了同样的错误。

有人知道吗?

flatmap-stream 已从 npm here

中删除

这就是它出现 404 错误的原因。确保更新正在使用 flatmap-stream 的依赖包,也许新版本不再使用它了。

这个 nodemon issue 有一些有用的信息。