Skip to content

Package chalk avoids starting the app #8212

Closed
@GregOnNet

Description

@GregOnNet

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Angular CLI: 1.5.0-rc.5
Node: 6.11.1
OS: win32 x64
Angular: 5.0.0-rc.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 2.0.0-beta.12
@angular/cli: 1.5.0-rc.5
@angular/material: 2.0.0-beta.12
@angular-devkit/build-optimizer: 0.0.31
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.34
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0-rc.5
@schematics/angular: 0.0.48
typescript: 2.5.3
webpack: 3.8.1

Repro steps.

You will find the project containing the configuration in the following repository: ngrx-aware

$ rm -rf node_modules
$ yarn install 
$ yarn start

The log given by the failure.

Inside type_checker.js an error is thrown.

Cannot read property 'constructor' of undefined
TypeError: Cannot read property 'constructor' of undefined
    at Object.<anonymous> (C:\workbench\scratch\ngrx-aware\node_modules\@ngtools\webpack\src\type_checker.js:14:37)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\workbench\scratch\ngrx-aware\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:18:24)
    at Module._compile (module.js:570:32)

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\nodejs\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `ng serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'ng serve'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ngrx-aware package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ng serve
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ngrx-aware
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ngrx-aware
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\workbench\scratch\ngrx-aware\npm-debug.log

Desired functionality.

  • no error starting the application

Mention any other details that might be useful.

  • The error is related to chalk
  • For me chalk is installed with verison 1.1.3
  • In type_checker.js the following call is made
// before
const chalkCtx = new chalk_1.default.constructor(chalk_1.default.supportsColor ? {} : { level: 1 });
// --------------------------^---------------------------^
  • chalk_1 has no property default
  • logging chalk_1 results in the following output
    { [Function]
      constructor: [Function: Chalk],
      supportsColor: { level: 1, hasBasic: true, has256: false, has16m: false } }
    
  • constructor and supportsColor can be used by removing default
// after
const chalkCtx = new chalk_1.constructor(chalk_1.supportsColor ? {} : { level: 1 });
  • Doing this get the CLI working again

Metadata

Metadata

Assignees

Labels

P1Impacts a large percentage of users; if a workaround exists it is partial or overly painfultype: bug/fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions