'GOOGLE_APPLICATION_CREDENTIALS' 无法识别

'GOOGLE_APPLICATION_CREDENTIALS' is not recognized

当我在 visual studio 上录制 npm init start 代码以使用 google 云平台时,终端给我这个错误:

'GOOGLE_APPLICATION_CREDENTIALS' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

翻译:"is not recognized as an internal or external command"

您正在使用 Google 云库,它依赖于身份验证。

引用 来自 Google docs:

GCP client libraries use a strategy called Application Default Credentials (ADC) to find your application's credentials. When your code uses a client library, the strategy checks for your credentials in the following order:

  1. First, ADC checks to see if the environment variable GOOGLE_APPLICATION_CREDENTIALS is set. If the variable is set, ADC uses the service account file that the variable points to. The next section describes how to set the environment variable.

  2. If the environment variable isn't set, ADC uses the default service account that Compute Engine, Kubernetes Engine, App Engine, and Cloud Functions provide, for applications that run on those services.

  3. If ADC can't use either of the above credentials, an error occurs.

您需要创建一个服务帐户并在使用该服务时创建一个凭据文件。之后,将 GOOGLE_APPLICATION_CREDENTIALS 设置为其路径。有关详细信息,请参阅 docs