为 dart 设置应用引擎,gcloud 预览错误

Setting up app engine for dart, gcloud preview error

我在为 dart 设置应用程序引擎开发时遇到问题

我正在使用
OS X 10.10
Dart SDK 1.11.1
Google 云 SDK 0.9.67

错误如下:

WC-Johndoe:dartsample Johndoe$ gcloud preview app run app.yaml
Module [default] found in file [/Users/Johndoe/Repos/dartsample/app.yaml]
INFO: Looking for the Dockerfile in /Users/Johndoe/Repos/dartsample
INFO: Using Dockerfile found in /Users/Johndoe/Repos/dartsample
INFO     2015-07-03 21:31:15,783 devappserver2.py:762] Skipping SDK update check.
INFO     2015-07-03 21:31:16,009 api_server.py:204] Starting API server at: http://localhost:53927
INFO     2015-07-03 21:31:16,010 api_server.py:629] Applying all pending transactions and saving the datastore
INFO     2015-07-03 21:31:16,010 api_server.py:632] Saving search indexes
Traceback (most recent call last):
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in <module>
    _run_file(__file__, globals())
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 79, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1027, in <module>
    main()
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1020, in main
    dev_server.start(options)
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 817, in start
    self._dispatcher.start(options.api_host, apis.port, request_data)
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 193, in start
    _module, port = self._create_module(module_configuration, port)
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 278, in _create_module
    threadsafe_override=threadsafe_override)
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1539, in __init__
    super(ManualScalingModule, self).__init__(**kwargs)
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 558, in __init__
    self._module_configuration)
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 259, in _create_instance_factory
    module_configuration=module_configuration)
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_factory.py", line 71, in __init__
    8 if runtime_config_getter().threadsafe else 1, 10)
  File "/Users/Johndoe/Library/Cloud/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 394, in _get_runtime_config
    raise ValueError('The --custom_entrypoint flag must be set for '
ValueError: The --custom_entrypoint flag must be set for custom runtimes
ERROR: (gcloud.preview.app.run) DevAppSever failed with error code [1]

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

快速查看 会发现 Google 的云 SDK 的最新版本存在问题。在进一步更新之前,使用其他一些 SDK(例如 dart)会出现问题。

如 link 中所述,要解决此问题,请使用终端中的命令回拨 Google 云 SDK 的版本:

gcloud config set component_manager/fixed_sdk_version 0.9.64
gcloud components update

通过以下方式恢复到当前版本的云 SDK:

gcloud config unset --scope=installation component_manager/fixed_sdk_version
gcloud components update

根据https://groups.google.com/a/dartlang.org/forum/#!topic/cloud/J6LsrVVdJ6o

将 GAE_LOCAL_VM_RUNTIME 环境变量设置为 0 应该可以解决此问题

$ export GAE_LOCAL_VM_RUNTIME=0
$ gcloud preview app run app.yaml