【发布时间】:2015-12-13 15:39:45
【问题描述】:
我正在做一个需要我使用 gcloud nodejs 模块的项目。我正在使用 node app 在本地测试这个项目,并在 gcloud 上使用 gcloud preview app run app.yaml 在本地测试。
当我的文件中有以下代码时,该项目使用 node app 运行,但不使用gcloud preview app run app.yaml 使用gcloud 运行-我收到invalid ELF Header 错误。
var gcloud = require('gcloud');
我相信该项目不能使用 gcloud 命令运行,因为它与我在项目中使用 gcloud 模块有关。如果我从我的文件中删除该代码,则该项目使用 gcloud 命令运行得很好。我应该怎么做才能解决这个问题?
我能够通过使用 try-catch 得到错误
try {
var gcloud = require('gcloud');
} catch (e) {
e = 'Error loading required classes for gcloud: '+gcloud+ ': '+e
console.log(e)
res.status(200).send(e);
}
错误:
Error loading required classes for gcloud: undefined: Error:
/app/node_modules/gcloud/node_modules/hash-stream-
validation/node_modules/sse4_crc32/build/Release/sse4_crc32.node: invalid ELF header
【问题讨论】:
-
您能否详细说明它以什么方式失败?听起来部署成功,但应用程序本身返回 500 秒...如果是这样,请在开发人员控制台中包含失败的 HTTP 请求的应用程序引擎日志条目。
-
我现在正在使用“运行”(gcloud preview app run app.yaml)命令在本地模拟它,我没有部署它,因为如果它没有在本地使用“运行”命令运行它不会在线工作。如果我在未注释 gcloud 代码时转到 localhost:8080,它将不会加载任何内容,只会给我超时错误,但如果我取消注释 gcloud 代码,那么我工作得很好。
-
即使我只有 var gcloud = require('gcloud') 它也不起作用
-
错误看起来像stackoverflow.com/q/32679728/3645370。你可以试试那里的答案吗?
-
这个问题并没有真正的答案——他说他从 Eclipse IDE 中移出并且它起作用了。我没有使用 IDE - 我使用的是 Sublime Text。实际上,我早些时候曾对这个问题发表过评论,试图联系这个人,并更深入地了解他是如何解决问题的,但还没有收到回复。
标签: javascript node.js google-app-engine google-compute-engine gcloud-node