Skip to content
This repository has been archived by the owner on Sep 11, 2019. It is now read-only.

'TypeError: Cannot read property \'ssl\' of undefined #2

Closed
wangxh0812 opened this issue Aug 26, 2016 · 5 comments
Closed

'TypeError: Cannot read property \'ssl\' of undefined #2

wangxh0812 opened this issue Aug 26, 2016 · 5 comments

Comments

@wangxh0812
Copy link

wangxh0812 commented Aug 26, 2016

运行环境:ubuntu-16.04 node v4.5.0
启动命令: node app.js
启动报错:message: 'Cannot read property 'ssl' of undefined',
stack: 'TypeError: Cannot read property 'ssl' of undefined\n at async.auto.network (/home/wangxh/awork/blockchain/ebookcoin/ebookcoin-master/app.js:221:20)
执行if (scope.config.ssl.enabled) 这行代码时出错
具体代码段:

network: ['config', function (cb, scope) {
            var express = require('express');
            var app = express();
            var server = require('http').createServer(app);
            var io = require('socket.io')(server);
            if (scope.config.ssl.enabled) {
                var privateKey = fs.readFileSync(scope.config.ssl.options.key);
                var certificate = fs.readFileSync(scope.config.ssl.options.cert);
                var https = require('https').createServer({
                    key: privateKey,
                    cert: certificate
                }, app);
                var https_io = require('socket.io')(https);
            }
            cb(null, {
                express: express,
                app: app,
                server: server,
                io: io,
                https: https,
                https_io: https_io
            });
        }]
@imfly
Copy link
Member

imfly commented Aug 26, 2016

目前,系统受环境限制,建议:

操作系统使用 ubuntu 14.04.*
Node.js的版本使用 0.12.*

后续的版本,会逐步更新到最新的lts版本。

@wangxh0812
Copy link
Author

应该不是版本的问题,我把环境切成ubuntu 14.04.5 nodejs 0.12.15 还是报同样的错误,把function (cb, scope) 改成function ( scope,cb)就可以了,但是不知道这个参数是从哪儿传过来的

@wangxh0812
Copy link
Author

network: ['config', function (cb, scope) {将这段代码改成network: ['config', function ( scope,cb) {包括dbSequence,sequence,balancesSequence等,就可以执行起来了

imfly added a commit that referenced this issue Aug 29, 2016
@imfly imfly added the bug label Aug 29, 2016
@imfly
Copy link
Member

imfly commented Aug 29, 2016

async最新版本是2.0.0,修改了一些Api,比如这里的.auto函数,最新版确实应该使用network: ['config', function ( scope, cb),也更符合一贯的编码习惯,即:把回调放在最后。 不过,咱们暂时不做升级了。

@imfly imfly closed this as completed Aug 29, 2016
@wangxh0812
Copy link
Author

It's OK.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant