我在使用OpenShift托管的应用导入Firebase npm模块时遇到错误。
以下一行
TypeError: Cannot use 'in' operator to search for '$__firebase' in undefined at /var/lib/openshift/57408de67628e1e65b00006a/app-root/runtime/repo/node_modules/firebase/app-node.js:19:449
at Object.<anonymous> (/var/lib/openshift/57408de67628e1e65b00006a/approot/runtime/repo/node_modules/firebase/app-node.js:19:617)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/lib/openshift/57408de67628e1e65b00006a/app-root/runtime/repo/node_modules/firebase/firebase-node.js:8:18)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at /var/lib/openshift/57408de67628e1e65b00006a/app-root/runtime/repo/app.js:12:20
在日志文件
中生成以下输出$ node app.js
奇怪的是,如果我执行
def create
@foo = Model1.find(params[:array_of_ids])
@foo.each do |f|
@boo = Model2.new
@boo.attributes = f.attributes
@boo.save! unless Model2.exists?(@boo.id)
end
end
没有错误,应用运行正常。
答案 0 :(得分:1)
如果您使用带有start.js和群集的磁带,请尝试删除package.json中的--use-strict选项。
有关严格模式的更多详细信息,请参阅此stackoverflow q&amp; a:in-node-js-how-the-use-strict-statement-is-interpreted
希望它有所帮助!