Unable to run application in Google Compute Engine VM

孤街醉人 提交于 2019-12-11 14:33:59

问题


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);
}

When I run this code

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

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??


回答1:


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?



来源:https://stackoverflow.com/questions/32679728/unable-to-run-application-in-google-compute-engine-vm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!