I don't seem to see this exact issue here, but I create my angular project, then run
ng g app dashboard --routing -p=app --style=scss --d
I get the following prompts
? In which directory should the application be generated? apps
? Which Unit Test Runner would you like to use for the application? Karma [ https://karma-runner.github.io ]
? Which E2E Test Runner would you like to use for the application? Protractor [ https://www.protractortest.org ]
? Which tags would you like to add to the application? (used for linting) test
I end up with the error
Cannot read property 'toString' of null
I'm obviously doing something wrong, any suggestions?
Angular CLI: 7.3.3
Node: 9.9.0
OS: darwin x64
Angular: 7.2.6
@angular-devkit/architect 0.13.3
@angular-devkit/build-angular 0.13.3
@angular-devkit/build-optimizer 0.13.3
@angular-devkit/build-webpack 0.13.3
@angular-devkit/core 7.3.3
@angular-devkit/schematics 7.3.3
@angular/cli 7.3.3
@ngtools/webpack 7.3.3
@schematics/angular 7.3.3
@schematics/update 0.13.3
rxjs 6.3.3
typescript 3.2.4
webpack 4.29.0
"@nrwl/nx": "7.6.0",
"@nrwl/schematics": "7.6.0",
Please describe the behavior you are expecting
Create a new app called "dashboard" in "apps" directory
What is the current behavior?
Cannot read property 'toString' of null
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.
I'm seeing this issue as well. Haven't used nx before, just trying to follow https://nrwl.io/nx/guide-nx-workspace as written.
$ ng --version
Angular CLI: 7.3.0
Node: 10.15.1
OS: win32 x64
Angular: 7.2.6
...
typescript 3.2.2
@nrwl/[email protected]
$ create-nx-workspace workspace
(completes fine)
$ cd workspace
$ ng g app example
? In which directory should the application be generated? example
? Would you like to add Angular routing? No
? Which Unit Test Runner would you like to use for the application? Jest [ https://jestjs.io ]
? Which E2E Test Runner would you like to use for the application? Cypress [ https://www.cypress.io ]
? Which tags would you like to add to the application? (used for linting)
Path "/apps/example/example-e2e/tsconfig.e2e.json" does not exist.
$ ng g app example
? In which directory should the application be generated? example
? Would you like to add Angular routing? No
? Which Unit Test Runner would you like to use for the application? Karma [ https://karma-runner.github.io ]
? Which E2E Test Runner would you like to use for the application? Protractor [ https://www.protractortest.org ]
? Which tags would you like to add to the application? (used for linting) test
Cannot read property 'toString' of null
Exact same issue here.
Angular CLI: 7.3.3
Node: 10.10.0
OS: win32 x64
Angular: 7.2.6
@angular-devkit/architect 0.13.3
@angular-devkit/build-angular 0.13.3
@angular-devkit/build-optimizer 0.13.3
@angular-devkit/build-webpack 0.13.3
@angular-devkit/core 7.3.3
@angular-devkit/schematics 7.3.3
@angular/cli 7.3.3
@ngtools/webpack 7.3.3
@schematics/angular 7.3.3
@schematics/update 0.13.3
rxjs 6.4.0
typescript 3.2.4
webpack 4.29.0
$ ng g app demo
? In which directory should the application be generated? demo
? Would you like to add Angular routing? Yes
? Which Unit Test Runner would you like to use for the application? Karma [ https://karma-runner.github.io ]
? Which E2E Test Runner would you like to use for the application? Protractor [ https://www.protractortest.org ]
? Which tags would you like to add to the application? (used for linting) lintTag
Cannot read property 'toString' of null
It looks like a bug in newest version of schematic. It works when you downgrade it to previous version:
npm install -g @angular/cli @nrwl/schematics@~7.5.2
+1
You can also solve this issue by using @nrwl/[email protected] and @angular/[email protected].
Another problem caused by @nrwl/[email protected] and @angular/[email protected] is that you can't generate a lib.
ng generate @nrwl/schematics:library mylib
Path "/libs/mylib/src/lib/mylib.service.ts" does not exist.
@isaacplmann is right, @angular/[email protected] has a breaking change with how applications and libraries are generated.
✅ A fix has been released in @nrwl/[email protected] which fixes the issue for new workspaces.
✅ Update: @nrwl/[email protected] has been released resolving the issue for updating workspaces.
⌛️ We are also working with the Angular CLI on the breaking change.
Sorry for the inconvenience. 😞
I'm going to mark this as resolved form our end. We've rolled out @nrwl/[email protected] which should not have this issue anymore. Let us know if you see anymore issues.
Issue still persists with @nrwl/[email protected]:
Cannot read property 'toString' of null
Also I'm getting different error messages if I pick different E2E frameworks:
Cannot read property 'toString' of nullPath "/apps/myapp-e2e/tsconfig.e2e.json" does not exist._Edit:_ Generation of libs also broken with exact error message posted by @isaacplmann.
Looks like a regression to me...
Angular CLI: 7.3.3
Node: 11.9.0
OS: darwin x64
Angular: 7.2.6
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.13.3
@angular-devkit/build-angular 0.13.3
@angular-devkit/build-ng-packagr 0.13.3
@angular-devkit/build-optimizer 0.13.3
@angular-devkit/build-webpack 0.13.3
@angular-devkit/core 7.3.3
@angular-devkit/schematics 7.3.3
@angular/cdk 7.3.3
@angular/cli 7.3.3
@ngtools/json-schema 1.1.0
@ngtools/webpack 7.3.3
@schematics/angular 7.3.3
@schematics/update 0.13.3
ng-packagr 4.7.1
rxjs 6.4.0
typescript 3.2.4
webpack 4.29.0
I noticed the same problem during generating library with config:
Angular CLI: 7.2.4
Node: 8.11.3
OS: linux x64
Angular: 7.2.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.11.4
@angular-devkit/build-angular 0.11.4
@angular-devkit/build-optimizer 0.11.4
@angular-devkit/build-webpack 0.11.4
@angular-devkit/core 7.2.4
@angular-devkit/schematics 7.2.4
@angular/cdk 7.3.3
@angular/cli 7.2.4
@angular/material 7.3.3
@ngtools/webpack 7.1.4
@schematics/angular 7.3.3
@schematics/update 0.12.4
rxjs 6.3.3
typescript 3.2.4
webpack 4.23.1
I tried 7.5.1, 7.6.1, 7.6.2 versions of @nrwl/schematics.
In our project this issue was reproducible with latest angular cli and nx. Cause of issue was @angular/pwa package or some of 14 derived dependencies. I didn't dig deep enough but workaround is to delete @angular/pwa. Angular CLI with nx working after that as expected.
I tried all combinations above, and none of them works. Always failing at the e2e step with above errors.
I was having this issue with ng generate app , without any extra config.
After updating schematics and angular cli it worked.
@nrwl/[email protected]
@angular/[email protected]
Can confirm in my project CLI works again after upgrading angular and NX libs.
Most helpful comment
You can also solve this issue by using
@nrwl/[email protected]and@angular/[email protected].Another problem caused by
@nrwl/[email protected]and@angular/[email protected]is that you can't generate a lib.