nrwl / nx

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

After upgrading from nx 7 (@nrwl/nx": "^7.8.6) to nx 8, cant create apps #1937

Closed charl-kruger closed 4 years ago

charl-kruger commented 4 years ago

Expected Behavior

After upgrading from nx 7 (@nrwl/nx": "^7.8.6) to nx 8 via https://nx.dev/angular/guides/nx7-to-nx8, application compiles successfully however we cannot generate new applications :(

These were the steps taken from the above guide:

Running either of the below should complete successfully:

ng g app myapp

ng g @nrwl/angular:application myapp

Current Behavior

App fails to create, nothing is generated.

Failure Information (for bugs)

Error message: Path "/myapp/e2e/src/app.e2e-spec.ts" does not exist.

ng g @nrwl/angular:application myapp
? In which directory should the application be generated?
? Which stylesheet format would you like to use? SASS(.scss)  [ http://sass-lang.com   ]
? Would you like to configure routing for this application? No
Path "/myapp/e2e/src/app.e2e-spec.ts" does not exist.

Context

Please provide any relevant information about your setup:

ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 8.1.1
Node: 10.16.3
OS: win32 x64
Angular: 9.0.0-next.9
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.801.3
@angular-devkit/build-angular      0.801.3
@angular-devkit/build-ng-packagr   0.801.3
@angular-devkit/build-optimizer    0.801.3
@angular-devkit/build-webpack      0.801.3
@angular-devkit/core               7.1.4
@angular-devkit/schematics         7.1.4
@angular/cli                       8.1.1
@angular/localize                  9.0.0-next.5
@angular/pwa                       0.11.4
@ngtools/webpack                   8.1.3
@schematics/angular                7.1.4
@schematics/update                 0.801.1
ng-packagr                         5.6.1
rxjs                               6.5.3
typescript                         3.4.5
webpack                            4.35.2
  "dependencies": {
    "@angular/animations": "^9.0.0-next.9",
    "@angular/common": "^9.0.0-next.9",
    "@angular/compiler": "^9.0.0-next.9",
    "@angular/core": "^9.0.0-next.9",
    "@angular/forms": "^9.0.0-next.9",
    "@angular/localize": "^9.0.0-next.5",
    "@angular/platform-browser": "^9.0.0-next.9",
    "@angular/platform-browser-dynamic": "^9.0.0-next.9",
    "@angular/pwa": "^0.11.4",
    "@angular/router": "^9.0.0-next.9",
    "@angular/service-worker": "^9.0.0-next.9",
    "@fortawesome/angular-fontawesome": "^0.2.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.4",
    "@fortawesome/free-brands-svg-icons": "^5.3.1",
    "@fortawesome/free-regular-svg-icons": "^5.3.1",
    "@fortawesome/free-solid-svg-icons": "^5.3.1",
    "@ng-bootstrap/ng-bootstrap": "^4.0.0",
    "@ngrx/effects": "8.1.0",
    "@ngrx/router-store": "8.1.0",
    "@ngrx/store": "8.1.0",
    "@ngxs/devtools-plugin": "^3.3.4",
    "@ngxs/logger-plugin": "^3.3.4",
    "@ngxs/store": "^3.3.4",
    "@nrwl/angular": "8.4.8",
    "@types/jwt-decode": "^2.2.1",
    "add": "^2.0.6",
    "angular-playground": "^5.8.1",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.4",
    "intl": "^1.2.5",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.10",
    "moment-mini": "^2.22.1",
    "ngx-cookie-service": "^2.2.0",
    "rxjs": "6.5.3",
    "rxjs-compat": "6.2.2",
    "ts-deferred": "^1.0.4",
    "zone.js": "^0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.801.1",
    "@angular-devkit/build-ng-packagr": "~0.801.1",
    "@angular/cli": "8.1.1",
    "@angular/compiler-cli": "^9.0.0-next.9",
    "@angular/language-service": "^9.0.0-next.9",
    "@ngrx/schematics": "^8.1.0",
    "@ngrx/store-devtools": "8.1.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.5.0",
    "fs-extra": "^7.0.1",
    "husky": "^3.0.5",
    "jasmine-core": "~2.99.1",
    "jasmine-marbles": "0.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.0.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "ng-packagr": "^5.6.1",
    "prettier": "1.16.4",
    "protractor": "~5.4.0",
    "sonar-scanner": "^3.1.0",
    "ts-node": "~7.0.0",
    "tsickle": ">=0.25.5",
    "tslib": "^1.7.1",
    "tslint": "~5.11.0",
    "typescript": "~3.4.5",
    "@nrwl/workspace": "8.4.8"
  }
fen89 commented 4 years ago

@CharlJKruger We had that excact same issue last week coming up (creating apps and libs was not possible anymore after the upgrade). After struggling through the codebase we found out that we had some old schematics inside the angular.json as base schematics for the project.

 ng g lib ui
? Which stylesheet format would you like to use? SASS(.scss)  [ http://sass-lang.com   ]
Path "/libs/ui/src/lib/ui.service.spec.ts" does not exist. 

Removal of old schematic references inside angular.json made this work again. For reference, we had this section inside the root of our angular.json (near the bottom of the file):

...
"schematics": {
        "@schematics/angular:component": {
          "styleext": "scss",
          "spec": false
        },
        "@schematics/angular:class": {
          "spec": false
        },
        "@schematics/angular:directive": {
          "spec": false
        },
        "@schematics/angular:guard": {
          "spec": false
        },
        "@schematics/angular:module": {
          "spec": false
        },
        "@schematics/angular:pipe": {
          "spec": false
        },
        "@schematics/angular:service": {
          "spec": false
        }
      },
...

Hope this helps!

vsavkin commented 4 years ago

@fen89 this is a good catch. I'll update the guide. Are you interested in submitting a PR that updates the migration?

vsavkin commented 4 years ago

Pushed the updated docs to master.

FintanK commented 4 years ago

I am still able to replicate this issue. Removing the old schematic references also doesn't seem to resolve the issue.

image

Angular CLI: 8.3.18 Node: 10.15.0 OS: win32 x64 Angular: 8.2.13 ... animations, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... platform-server, router, service-worker

Package Version

@angular-devkit/architect 0.803.18 @angular-devkit/build-angular 0.803.18 @angular-devkit/build-optimizer 0.803.18 @angular-devkit/build-webpack 0.803.18 @angular-devkit/core 8.3.18 @angular-devkit/schematics 8.3.3 @angular/cdk 8.2.3 @angular/cli 8.3.18 @angular/pwa 0.13.9 @ngtools/webpack 8.3.18 @nguniversal/module-map-ngfactory-loader 8.1.1 @schematics/angular 7.3.9 @schematics/update 0.803.18 rxjs 6.5.3 typescript 3.5.3 webpack 4.39.2

FintanK commented 4 years ago

For anyone else struggling with my last comment. A temporary workaround is to edit

node_modules/@nrwl/angular/src/schematics/application/application.js

and comment out

host.delete(${e2eProjectRoot}/src/app.e2e-spec.ts); host.delete(${e2eProjectRoot}/src/app.po.ts); host.delete(${e2eProjectRoot}/protractor.conf.js); host.delete(${e2eProjectRoot}/tsconfig.json);

fen89 commented 4 years ago

@vsavkin I somehow missed the github notification on this one, sorry for the delay. As @FintanK pointed out there might be some more issues related to that upgrade. Could you provide me an entry point where I should start to implement that kind of migration? I really would like to try to contribute as I'm really enjoying nx!

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.