无法在Google Compute Engine VM中运行应用程序 [英] Unable to run application in Google Compute Engine VM

查看:119
本文介绍了无法在Google Compute Engine VM中运行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Node.js应用程序,该应用程序可以在localhost上正确运行,但不能在Compute Engine VM中运行.这是一个代码段:

I have a Node.js application which runs correctly on localhost, but not in the Compute Engine VM. Here is a snippet:

try {
    gcloud = require('gcloud');
    var storage = gcloud.storage({ projectId: 'project-id' });
    var bucket = storage.bucket('my-bucket');
    bucket.file(src_file).createReadStream().pipe(fs.createWriteStream(src_file));
} catch (e) {
    e = 'Error loading required classes for gcloud: '+gcloud+ ':  '+e
    console.log(e)
    res.status(200).send(e);
}

当我运行这段代码时

未定义:错误:/app/node_modules/gcloud/node_modules/hash-stream-validation/node_modules/sse4_crc32/build/Release/sse4_crc32.node:无效的ELF标头

undefined: Error: /app/node_modules/gcloud/node_modules/hash-stream-validation/node_modules/sse4_crc32/build/Release/sse4_crc32.node: invalid ELF header

看起来我无法导入gcloud类,但是我不明白为什么它可以在localhost而不在GCE服务器上工作?

It looks like I'm not able to import the gcloud classes, but I can't understand why it works in localhost but not in the GCE server??

推荐答案

无效的ELF声音听起来像是从本地主机上载的,或者是在其他环境中编译的.这些部门需要在Google服务器上进行编译/配置.您是否遵循这些说明?

Invalid ELF sounds like you uploaded from localhost or compiled in a different environment. Those deps need to be compiled/configured on the Google server. Did you follow these instructions?

这篇关于无法在Google Compute Engine VM中运行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆