本文介绍了无法在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);
}
当我运行这段代码时
看起来我无法导入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中运行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!