ng generate lib mylib --dry-run
newTree.optimize is not a function
./node_modules/.bin/nx --version
6.1.1
ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ â–³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.1.0-rc.3
Node: 10.5.0
OS: darwin x64
Angular: 6.1.0-rc.3
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.7.0-rc.3
@angular-devkit/build-angular 0.7.0-rc.3
@angular-devkit/build-ng-packagr 0.7.0-rc.3
@angular-devkit/build-optimizer 0.7.0-rc.3
@angular-devkit/build-webpack 0.7.0-rc.3
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cdk 6.4.0
@angular/cdk-experimental 6.4.0
@angular/flex-layout 6.0.0-beta.16
@angular/material 6.4.0
@angular/material-moment-adapter 6.4.0
@angular/pwa 0.6.8
@ngtools/json-schema 1.1.0
@ngtools/webpack 6.1.0-rc.3
@schematics/angular 0.6.8
@schematics/update 0.7.0-rc.3
ng-packagr 4.0.0
rxjs 6.2.2
typescript 2.9.2
webpack 4.9.2
it seems to be a problem with angular-cli. Last version working was @angular/[email protected], see https://github.com/angular/angular-cli/issues/11532
I have the same problem.
6.1.0 cli is released. Hope nx support it soon.
Same here with ionic generate component myComponent
This resolved an issue: npm install --save-dev @angular/[email protected]
I tried the @jviaches solution, and worked. so the bug is in @angular/cli > 6.1.0-rc.0
Got the same issue :/
Hoping this helps whoever is hunting this bug down...
This is probably a problem with @angular-devkit/schematics(-cli).
I'm creating my own schematics and I have @angular/cli@latest installed but I get this error if I install any version of the devkit after @angular-devkit/[email protected]
My schematics project package.json has the following installed
"@angular-devkit/core": "0.6.8",
"@angular-devkit/schematics": "0.6.8",
"@angular/cli": "6.1.1",
Getting this error so reverted back to 6.1.0-rc.0, now getting "Could not find an NgModule. Use the skip-import option to skip importing in NgModule"
Beginning to dig into this now...following here hoping for a resolution.
Thx.
Deleting node_modules and running yarn seems to have fixed the "Could not find an NgModule" error.
Angular CLI 6.1 will be supported by Nx 6.2, which is going to be released soon.
ng -v
`
$ ng -v
Angular CLI: 6.1.1
Node: 10.5.0
OS: linux x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker
@angular-devkit/architect 0.7.1
@angular-devkit/build-angular 0.7.1
@angular-devkit/build-optimizer 0.7.1
@angular-devkit/build-webpack 0.7.1
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.1.1
@angular/pwa 0.7.1
@ngtools/webpack 6.1.1
@schematics/angular 0.6.8
@schematics/update 0.7.1
rxjs 6.2.2
typescript 2.9.2
webpack 4.9.2
`
Reverting back to 6.1.0-rc.0 does not seem to work. For me at least.
Result after reverting and redoing yarn (after deleting node_modules):
$ ng g lib common-core
ERROR! common-core/karma.conf.js does not exist..
ERROR! common-core/ng-package.json does not exist..
ERROR! common-core/ng-package.prod.json does not exist..
ERROR! common-core/package.json does not exist..
ERROR! common-core/tsconfig.lib.json does not exist..
ERROR! common-core/tsconfig.spec.json does not exist..
ERROR! common-core/tslint.json does not exist..
ERROR! common-core/src/index.ts does not exist..
ERROR! common-core/src/test.ts does not exist..
ERROR! common-core/src/lib/common-core.component.ts does not exist..
ERROR! common-core/src/lib/common-core.module.ts does not exist..
ERROR! libs/common-core/src/lib/common-core.module.ts does not exist..
ERROR! libs/common-core/src/index.ts does not exist..
ERROR! libs/common-core/tsconfig.lib.json does not exist..
ERROR! libs/common-core/tsconfig.spec.json does not exist..
ERROR! libs/common-core/tslint.json does not exist..
ERROR! libs/common-core/karma.conf.js does not exist..
The Schematic workflow failed. See above.
Any patches/workarounds in the meantime?
Update: I uninstalled nrwl/schematics and the angular/cli from global then reinstalled. Deleted the project folder and recreated the project using the create-nx-workspace command. I have to refer to 0.6.8 in the ng add @angular/[email protected] in order to add the pwa. That worked correctly. Once that was all done, I used the ng g lib common-ui (instead of common-core; mainly it seems semantically better) and it seems to be working.
I did notice this its was generating the lib:
warning " > @ngrx/[email protected]" has incorrect peer dependency "@angular/core@^5.0.0".
warning " > @ngrx/[email protected]" has incorrect peer dependency "rxjs@^5.5.0".
warning " > @ngrx/[email protected]" has incorrect peer dependency "@angular/common@^5.0.0".
warning " > @ngrx/[email protected]" has incorrect peer dependency "@angular/core@^5.0.0".
warning " > @ngrx/[email protected]" has incorrect peer dependency "@angular/router@^5.0.0".
warning " > @ngrx/[email protected]" has incorrect peer dependency "rxjs@^5.5.0".
warning " > @ngrx/[email protected]" has incorrect peer dependency "@angular/core@^5.0.0".
warning " > @ngrx/[email protected]" has incorrect peer dependency "rxjs@^5.5.0".
warning " > @ngrx/[email protected]" has incorrect peer dependency "rxjs@^5.5.0".
warning " > @nrwl/[email protected]" has unmet peer dependency "@schematics/angular@^0.6.0".
warning " > @nrwl/[email protected]" has unmet peer dependency "@angular-devkit/schematics@^0.6.0".
I noticed earlier and updated each peer dependency and that is where I think the issues started to occur. Do you think that when trying to update to the correct peers, there is a chance the link mismatching?
I did not do the updates to the peers this time and everything seems to work so far.
Most helpful comment
Same here with
ionic generate component myComponentThis resolved an issue:
npm install --save-dev @angular/[email protected]