Just depend directly on chalk
version 2.4.2 in package @nrwl/workspace
.
As it's used directly in the library it should have a direct dependency rather than an indirect one to an ambiguous version. Where latest version is likely required due to below described issue which likely stems from some TypeScript related import issues solved in a later version.
Should be able to have any prior chalk versions installed by yarn.lock
.
Having some deprecated chalk versions installed by yarn.lock
may crash default Cypress e2e testing.
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Please provide detailed steps for reproducing the issue.
ng e2e normative-client-e2e --watch --baseUrl=http://localhost:9000
@nrwl/workspace
,@nrwl/angular
& @nrwl/cypress
8.3.0 to 8.4.2 (no issue in 8.2.0)yarn.lock
file have an old 2.x version of Chalk saved. Both or either of 2.3.0 and 2.4.1 were too old. Specifically I had these Chalk versions:[email protected], chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
dependencies:
ansi-styles "^3.2.1"
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"
chalk@^2.0.0, chalk@^2.0.1, chalk@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e"
integrity sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==
dependencies:
ansi-styles "^3.2.1"
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
chalk@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba"
integrity sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==
dependencies:
ansi-styles "^3.1.0"
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"
In console:
> yarn e2e
yarn run v1.17.3
$ ng e2e normative-client-e2e --watch --baseUrl=http://localhost:9000
An unhandled exception occurred: Cannot read property 'cyan' of undefined
See "/private/var/folders/c2/20w3pxsj5lg8_n15ktkwjqhw0000gn/T/ng-P9xrPY/angular-errors.log" for further details.
error Command failed with exit code 127.
In mentioned file there's this error message:
[error] TypeError: Cannot read property 'cyan' of undefined
at new CLIOutput (/Users/koslun/repos/normative/normative-client/node_modules/@nrwl/workspace/src/command-line/output.js:12:42)
at Object.<anonymous> (/Users/koslun/repos/normative/normative-client/node_modules/@nrwl/workspace/src/command-line/output.js:134:18)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/Users/koslun/repos/normative/normative-client/node_modules/@nrwl/workspace/index.js:24:16)
When I have a look at the first 12 lines of the line crashing you see this:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var chalk_1 = require("chalk");
/**
* Automatically disable styling applied by chalk if CI=true
*/
if (process.env.CI === 'true') {
chalk_1.default.level = 0;
}
var CLIOutput = /** @class */ (function () {
function CLIOutput() {
this.NX_PREFIX = chalk_1.default.cyan('>') + " " + chalk_1.default.reset.inverse.bold.cyan(' NX ');
It is thus evident it crashes from trying to use chalk
in @nrwl/workspace
, specifically corresponding to this line in the repo: https://github.com/nrwl/nx/blob/master/packages/workspace/src/command-line/output.ts#L1.
Curiously the package itself is not depending on a specific version of chalk
.
The issue could thus be locally fixed by manually removing old versions of Chalk in yarn.lock
that could match against the current latest version of Chalk 2.4.2
. Thus I removed the Chalk versions above that matched versions 2.3.0
and 2.4.1
.
Can thus deduct that either version 2.3.0 or/and 2.4.1 of Chalk does not actually work with latest version of @nrwl/workspace
.
Looking at the commits Chalk was introduced in this https://github.com/nrwl/nx/commit/8271c7650e95219205591878b5191b4513216915, which first became public in version 8.3.0. Matching when the issue surfaced.
I also encountered a problem with chalk today. It interfered with building an angular app with Ivy enabled.
ERROR in There is no appropriate source code format in '**PROJECT**/node_modules/chalk' entry-point.
Thank you, folks. Added an explicit dependency here: 61194ab171e6753f9449fa2f77dfc52c9636c6b9
I also encountered a problem with chalk today. It interfered with building an angular app with Ivy enabled.
ERROR in There is no appropriate source code format in '**PROJECT**/node_modules/chalk' entry-point.
Looks like the package.json of chalk doesn't contain the main property.
Same problem when i compile a library with latest dependencies installed ("@angular/core": "9.0.0-next.3", "@angular/cli": "8.3.0", "@nrwl/workspace": "8.4.12")
Compiling TypeScript sources through ngc
ERROR: There is no appropriate source code format in '/Users/gcirone/Works/sports/sports-devkit/node_modules/chalk' entry-point.
An unhandled exception occurred: There is no appropriate source code format in '/Users/gcirone/Works/sports/sports-devkit/node_modules/chalk' entry-point.
See "/private/var/folders/v_/z37jjw197mz2gdlj0qn0dc1xdbwcy6/T/ng-Pcz5jN/angular-errors.log" for further details.
Most helpful comment
I also encountered a problem with chalk today. It interfered with building an angular app with Ivy enabled.
ERROR in There is no appropriate source code format in '**PROJECT**/node_modules/chalk' entry-point.