nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.65k stars 2.36k forks source link

After upgrade to nx 14.8.3 and angular 14 nx generate library/component is not working #12732

Closed DimitriLib closed 2 years ago

DimitriLib commented 2 years ago

Run upgrade process for nx using migrate utility. After migration build works, but generating component and libraries failing.

Here are the dependencies and devdependencies:

"dependencies": { "@angular-builders/custom-webpack": "14.0.1", "@angular/animations": "14.2.5", "@angular/cdk": "14.2.4", "@angular/common": "14.2.5", "@angular/compiler": "14.2.5", "@angular/core": "14.2.5", "@angular/forms": "14.2.5", "@angular/material": "14.2.4", "@angular/platform-browser": "14.2.5", "@angular/platform-browser-dynamic": "14.2.5", "@angular/router": "14.2.5", "@angular/upgrade": "14.2.5", "@ngrx/effects": "14.0.2", "@ngrx/store": "14.0.2", "@ngrx/store-devtools": "14.0.2", "@nrwl/angular": "14.8.3", "@popperjs/core": "^2.11.6", "@storybook/core-server": "6.5.12", "@storybook/preset-scss": "^1.0.3", "@tinymce/tinymce-angular": "5.0.1", "@trellisorg/make-buildable": "^0.0.11", "ag-grid-angular": "28.2.0", "ag-grid-community": "28.2.0", "angular": "npm:@xlts.dev/angular@1.9.0", "angular-animate": "npm:@xlts.dev/angular-animate@1.9.0", "angular-aria": "npm:@xlts.dev/angular-aria@1.9.0", "angular-cache": "^4.6.0", "angular-clipboard": "^1.7.0", "angular-cookies": "npm:@xlts.dev/angular-cookies@1.9.0", "angular-file-saver": "1.1.3", "angular-hotkey": "0.2.1", "angular-pdfjs-viewer": "2.0.1", "angular-resizable-element": "5.0.0", "angular-resource": "npm:@xlts.dev/angular-resource@1.9.0", "angular-route": "npm:@xlts.dev/angular-route@1.9.0", "angular-sanitize": "npm:@xlts.dev/angular-sanitize@1.9.0", "angular-toarrayfilter": "1.0.3", "angular-ui-bootstrap": "2.5.6", "bootstrap": "3.4.1", "crypto-js": "4.1.1", "d3": "^6.7.0", "error-stack-parser": "^2.0.6", "jest-junit": "^13.2.0", "jquery": "^3.6.1", "jquery-ui": "^1.13.2", "jquery-ui-bundle": "*", "luxon": "^3.0.4", "material-icons": "^1.12.0", "ng-device-detector": "5.1.4", "ng-file-upload": "12.2.13", "rxjs": "~7.5.0", "tinymce": "5.10.3", "tslib": "^2.4.0", "ui-select": "^0.19.8", "zone.js": "0.11.4" }, "devDependencies": { "@angular-architects/ddd": "2.1.2", "@angular-devkit/build-angular": "14.2.5", "@angular-eslint/eslint-plugin": "14.0.4", "@angular-eslint/eslint-plugin-template": "14.0.4", "@angular-eslint/template-parser": "14.0.4", "@angular/cli": "~14.2.0", "@angular/compiler-cli": "14.2.5", "@angular/language-service": "14.2.5", "@compodoc/compodoc": "1.1.19", "@nrwl/cli": "14.8.3", "@nrwl/cypress": "14.8.3", "@nrwl/eslint-plugin-nx": "14.8.3", "@nrwl/jest": "14.8.3", "@nrwl/linter": "14.8.3", "@nrwl/storybook": "14.8.3", "@nrwl/workspace": "14.8.3", "@storybook/addon-a11y": "6.5.12", "@storybook/addon-essentials": "6.5.12", "@storybook/angular": "6.5.12", "@storybook/builder-webpack5": "6.5.12", "@storybook/manager-webpack5": "6.5.12", "@twittwer/compodoc": "1.8.2", "@types/jest": "28.1.8", "@types/jquery": "^3.5.14", "@types/node": "16.11.7", "@typescript-eslint/eslint-plugin": "5.36.1", "@typescript-eslint/parser": "5.36.1", "angular-template-cache": "^1.3.3", "autoprefixer": "10.4.12", "babel-plugin-angularjs-annotate": "^0.10.0", "constants-browserify": "^1.0.0", "copy-webpack-plugin": "6.3.2", "css-loader": "^6.5.1", "cypress": "^9.1.0", "dotenv": "8.2.0", "eslint": "8.25.0", "eslint-config-prettier": "8.5.0", "eslint-plugin-cypress": "2.12.1", "express": "4.17.1", "file-loader": "6.2.0", "gifsicle": "5.1.0", "jasmine-core": "4.2.0", "jest": "28.1.3", "jest-preset-angular": "12.2.2", "ng-packagr": "14.2.1", "nx": "14.8.3", "postcss": "8.3.9", "postcss-import": "14.1.0", "postcss-less": "^6.0.0", "postcss-preset-env": "7.5.0", "postcss-scss": "^4.0.4", "postcss-url": "10.1.3", "prettier": "2.6.2", "process": "^0.11.10", "react": "17.0.2", "react-dom": "17.0.2", "sass": "1.44.0", "sass-loader": "12.4.0", "style-loader": "3.3.1", "stylelint": "^14.7.1", "stylelint-config-standard": "^25.0.0", "ts-jest": "28.0.8", "typescript": "4.8.4", "url-loader": "4.1.1" },

when generating library: nx generate library Which generator would you like to use? ... selected @nrwl/angular:library

getting error:

NX Generating @nrwl/angular:library

√ What name would you like to use for the library? · mylib [NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. [NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. [NX] Angular devkit called writeWorkspace, this may have had unintended consequences in angular.json [NX] Double check angular.json before proceeding [NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. SchematicsException [Error]: Project "mylib" does not exist. at C:\cgi-work\tps-client\node_modules\@schematics\angular\component\index.js:99:19 at processTicksAndRejections (node:internal/process/task_queues:96:5)

NX Project "mylib" does not exist. Pass --verbose to see the stacktrace.

PS C:\cgi-work\tps-client> nx generate @nrwl/angular:component Test --project=shared-ui-datatable

NX Generating @nrwl/angular:component

[NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. Project extension with invalid name (files) found. TypeError: host.readText is not a function at readIntoSourceFile (C:\cgi-work\tps-client\node_modules\@schematics\angular\component\index.js:43:29) at C:\cgi-work\tps-client\node_modules\@schematics\angular\component\index.js:53:24 at callRuleAsync (C:\cgi-work\tps-client\node_modules\@schematics\angular\node_modules\@angular-devkit\schematics\src\rules\call.js:78:24) at C:\cgi-work\tps-client\node_modules\@schematics\angular\node_modules\@angular-devkit\schematics\src\rules\call.js:73:40 at Observable._subscribe (C:\cgi-work\tps-client\node_modules\@schematics\angular\node_modules\rxjs\internal\observable\defer.js:10:21) at Observable._trySubscribe (C:\cgi-work\tps-client\node_modules\@schematics\angular\node_modules\rxjs\internal\Observable.js:44:25) at Observable.subscribe (C:\cgi-work\tps-client\node_modules\@schematics\angular\node_modules\rxjs\internal\Observable.js:30:22) at MergeMapOperator.call (C:\cgi-work\tps-client\node_modules\@schematics\angular\node_modules\rxjs\internal\operators\mergeMap.js:37:23) at Observable.subscribe (C:\cgi-work\tps-client\node_modules\@schematics\angular\node_modules\rxjs\internal\Observable.js:25:31) at DefaultIfEmptyOperator.call (C:\cgi-work\tps-client\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\defaultIfEmpty.js:27:23)

NX host.readText is not a function

Pass --verbose to see the stacktrace.

Please provide details on fixing it.

Node : 16.13.0
OS : win32 x64
npm : 8.5.1

nx : 15.0.0
@nrwl/angular : 15.0.0
@nrwl/cypress : 15.0.0
@nrwl/detox : Not Found
@nrwl/devkit : 15.0.0
@nrwl/esbuild : Not Found
@nrwl/eslint-plugin-nx : 15.0.0
@nrwl/expo : Not Found
@nrwl/express : Not Found
@nrwl/jest : 15.0.0
@nrwl/js : 15.0.0
@nrwl/linter : 15.0.0
@nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/nx-cloud : Not Found @nrwl/nx-plugin : Not Found @nrwl/react : Not Found @nrwl/react-native : Not Found @nrwl/rollup : Not Found @nrwl/schematics : Not Found @nrwl/storybook : 15.0.0 @nrwl/web : Not Found @nrwl/webpack : 15.0.0 @nrwl/workspace : 15.0.0 typescript : 4.8.4

Local workspace plugins:

Community plugins: @ngrx/effects: 14.0.2 @ngrx/store: 14.0.2 @ngrx/store-devtools: 14.0.2 @trellisorg/make-buildable: 0.0.11 @compodoc/compodoc: 1.1.19 @storybook/angular: 6.5.12 @twittwer/compodoc: 1.8.2

Current Behavior

Expected Behavior

Steps to Reproduce

This issue may not be prioritized if details are not provided to help us reproduce the issue.

Failure Logs

Environment

willyboy commented 2 years ago

Seeing the same behavior with generating an Angular application

npx nx g @nrwl/angular:application tutorial --prefix=tut --routing --style="scss"
SchematicsException [Error]: Project "tutorial" does not exist.
willyboy commented 2 years ago

We found that @angular-devkit/schematic was pinned to version 13 by the @compodoc/compodoc package. By forcing devkit to 14 (adding it as a devDep in package.json) we resolved this issue.

leosvelperez commented 2 years ago

Thanks for reporting this!

Could you provide a repo where this issue can be reproduced? With the information provided, I could not reproduce it, and without a reproduction, we won't be able to troubleshoot it.

@DimitriLib did you check if https://github.com/nrwl/nx/issues/12732#issuecomment-1293848138 solves your issue?

DimitriLib commented 2 years ago

I ran migration again and it worked, using version nx 15. please close this issue. thank you looking into it.

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.