After update to Angular 8 CLI throws ".getColorDepth is not a function"
Look in the problematic file ./node_modules/@angular/cli/utilities/color.js
. Notice a comment above the problematic line (15):
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const colors = require("ansi-colors");
exports.colors = colors;
const tty_1 = require("tty");
// Typings do not contain the function call (added in Node.js v9.9.0)
exports.supportsColor = process.stdout instanceof tty_1.WriteStream &&
process.stdout.getColorDepth() > 1;
colors.enabled = exports.supportsColor;
Specifically:
// Typings do not contain the function call (added in Node.js v9.9.0)
Upgrading Node to a version no less than v9.9.0 fixes the problem.
but...
...choosing how to upgrade NodeJS is not necessairly straightforward. See How do I update Node.js?. Some popular answers are quite far down the page so it's worth scrolling through.
had the same error,
my versions:
Angular CLI: 8.1.1
Node: 11.14.0
OS: linux x64
Angular: 8.1.1
run:
rm -rf node_modules
rm -rf package-lock.json
sudo npm cache clean --force
npm install