I am getting msg.trim is not a function when trying to start new app with ionic

Here is error:

TypeError: msg.trim is not a function at Logger.log (/usr/local/lib/node_modules/ionic/node_modules/@ionic/cli-utils/lib/utils/logger.js:78:21) at Logger.error (/usr/local/lib/node_modules/ionic/node_modules/@ionic/cli-utils/lib/utils/logger.js:35:14) at Object. (/usr/local/lib/node_modules/ionic/dist/index.js:186:22) at Generator.throw () at rejected (/usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:101:69) at

and here is the command which I am running:

$ ionic start myApp

my node.js version is v8.9.1 and npm is 5.5.1

This what I found in logger.js file

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') + 'nn';
        }
        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));
    }
链接地址: http://www.djcxy.com/p/33020.html

上一篇: Sailsjs:在使用mongodb创建蓝图后服务器崩溃

下一篇: 当我尝试使用离子启动新应用程序时,msg.trim不是函数