0

我正在与google api集成来管理vms,使用的代码:

const {google} = require('googleapis');
const compute = google.compute('v1');
    async function listVMs() {
            const authClient = await google.auth.getClient({
              scopes: [
                'https://www.googleapis.com/auth/cloud-platform',
                'https://www.googleapis.com/auth/compute',
                'https://www.googleapis.com/auth/compute.readonly',
              ],
            });
          
            const projectId = await google.auth.getProjectId();
            const result = await compute.instances.aggregatedList({
              auth: authClient,
              project: projectId,
            });
            const vms = result.data;
            console.log('VMs:', vms);
          }
          listVMs();

我得到的错误:

node:internal/crypto/sig:131 const ret = this[kHandle].sign(data, format, type, passphrase, rsaPadding, ^

错误:错误:25078067:DSO 支持例程:win32_load:could not load the shared library at Sign.sign (node:internal/crypto/sig:131:29) at Object.sign (C:\Users\Mauricio Spagnol\workspace\ workBrightCloud\Bright Cloud Web Portal\backend\node_modules\jwa\index.js:152:45) 在 Object.jwsSign [as sign] (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules \jws\lib\sign-stream.js:32:24) 在 GoogleToken.requestToken (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\gtoken\build\src\index.js :225:31) 在 GoogleToken.getTokenAsyncInner (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\gtoken\build\src\index.js:163:21) 在 GoogleToken.getTokenAsync ( C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\gtoken\build\src\index.js:142:55) 在 GoogleToken.getToken (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\ Bright Cloud Web Portal\backend\node_modules\gtoken\build\src\index.js:94:21) 在 JWT.refreshTokenNoCache (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\google -auth-library\build\src\auth\jwtclient.js:171:36) 在 JWT.refreshToken (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\google-auth-library \build\src\auth\oauth2client.js:152:24) 在 JWT.getRequestMetadataAsync (C:\Users\Mauricio Spagnol\workspace\workBrightCloud\Bright Cloud Web Portal\backend\node_modules\google-auth-library\build\src \auth\oauth2client.js:284:28) { opensslErrorStack: [ '错误:0E076071:配置文件例程:module_run:未知模块名称','错误:0E07506E:配置文件例程:module_load_dso:错误加载dso','错误:25070067:DSO支持例程:DSO_load:无法加载共享库'] ,库:'DSO 支持例程',函数:'win32_load',原因:'无法加载共享库',代码:'ERR_OSSL_DSO_COULD_NOT_LOAD_THE_SHARED_LIBRARY'} 错误命令失败,退出代码 1。信息访问无法加载共享库',代码:'ERR_OSSL_DSO_COULD_NOT_LOAD_THE_SHARED_LIBRARY'} 错误命令失败,退出代码为 1。信息访问无法加载共享库',代码:'ERR_OSSL_DSO_COULD_NOT_LOAD_THE_SHARED_LIBRARY'} 错误命令失败,退出代码为 1。信息访问https://yarnpkg.com/en/docs/cli/run获取有关此命令的文档。

4

1 回答 1

1

解决方案是在项目中添加证书以作为 https 运行

于 2022-02-21T22:27:42.657 回答