TypeError: Cannot use 'in' operator to search for '$__firebase' in undefined
导入由Openshift托管的应用程序的FireBase NPM模块时出错。
下一行
1 | firebase = require('firebase/app'), |
在日志文件中生成以下输出
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 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. (/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. (/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
奇怪的是如果我执行
1 | $ node app.js |
没有错误,应用程序运行正常。
如果您将盒带与start.js和cluster一起使用,请尝试删除package.json中的--use strict选项。
有关严格模式的更多详细信息,请参阅此stackoverflow q&a:在节点js中,如何解释use strict语句
希望它有帮助!