我试图用离子启动新的应用程序时,msg.trim不是一个函数

时间:2017-11-10 14:16:26

标签: node.js ionic-framework npm

这是错误:

TypeError:msg.trim不是函数     在Logger.log(/usr/local/lib/node_modules/ionic/node_modules/@ionic/cli-utils/lib/utils/logger.js:78:21)     在Logger.error(/usr/local/lib/node_modules/ionic/node_modules/@ionic/cli-utils/lib/utils/logger.js:35:14)     在对象。 (/usr/local/lib/node_modules/ionic/dist/index.js:186:22)     在Generator.throw()     被拒绝(/usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:101:69)     在

这是我正在运行的命令:

$ ionic启动myApp

我的node.js版本是 v8.9.1 ,npm是 5.5.1

这是我在logger.js文件中找到的

log(level, msg) {
    if (this.shouldLog(level)) {
        let prefix = this.prefix;
        if (typeof msg === 'function') {
            msg = msg();
        }
        if (prefix) {
            if (typeof prefix === 'function') {
                prefix = prefix();
            }
            msg = util.format(prefix, msg);
        }
        const color = this.getStatusColor(level);
        const status = color.bold.bgBlack;
        const b = chalk_1.default.dim;
        const msgLines = format_1.wordWrap(msg, { indentation: level === 'info' ? 0 : level.length + 3 }).split('\n');
        if (msg.trim().includes('\n')) {
            msg = msgLines.map((l, i) => {
                // We want these log messages to stand out a bit, so automatically
                // color the first line and separate the first line from the other
                // lines if the message is multi-lined.
                if (i === 0 && this.firstLineColored.includes(level)) {
                    return color(l) + (msgLines.length > 1 ? '\n' : '');
                }
                return l;
            }).join('\n') + '\n\n';
        }
        else {
            msg = msgLines.join('\n');
        }
        msg = this.enforceLF(msg);
        const fmtLevel = () => b('[') + status(level.toUpperCase()) + b(']');
        if (level !== 'info') {
            msg = `${fmtLevel()} ${msg}`;
        }
        this.stream.write(util.format(msg));
    }

0 个答案:

没有答案