nrwl / nx

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

Cannot generate new app with nx 7.6 #1104

Closed guysenpai closed 5 years ago

guysenpai commented 5 years ago

Please make sure you have read the submission guidelines before posting an issue

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

Expected Behavior

ng g @nrwl/schematics:application app-name should create new app and app-name folder in apps folder

Current Behavior

ng g @nrwl/schematics:application app-name returns Path "/apps/app-name-e2e/tsconfig.e2e.json" does not exist.

Failure Information (for bugs)

Path "/apps/app-name-e2e/tsconfig.e2e.json" does not exist.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. step 1
  2. step 2
  3. ...

Context

Please provide any relevant information about your setup:

A minimal reproduce scenario using allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.

Failure Logs

Please include any relevant log snippets or files here.

Other

Any other relevant information that will help us help you.

FrozenPandaz commented 5 years ago

Hi all,

This issue should have been resolved. Both, new workspaces and migrated ones should be locked to CLI 7.3.1. CLI 7.3.3 has a breaking change for Nx so please do not use it.

People who migrated from 7.5.x to 7.6.0 then to 7.6.2 might not receive the fix so please lock the version of @angular/cli to 7.3.1 manually.

Can someone please provide steps to reproduce?

Are you using create-nx-workspace? yarn update? ng add?

See related issue: https://github.com/nrwl/nx/issues/1096

guysenpai commented 5 years ago

I used create-nx-workspace to create new workspace first. next I updated dependencies. But I have locked @angular/cli version to 7.3.1 and it's work. thanks @FrozenPandaz

merobal commented 5 years ago

Using nrwl/nx 7.6.2 and nrwl/schematics 7.6.2 AND roll back to cli 7.3.1 fixed this issue.

With latest CLI, I got this error during generating a lib (yes, with latest nrwl/schematics...): nx-generate-issue

What's the breaking change and how should we migrate our project?

FrozenPandaz commented 5 years ago

The breaking change is in @angular/cli@7.3.3. Lock to @angular/cli@7.3.1 and you should be fine.

The fix for the breaking change has been merged: https://github.com/angular/angular-cli/pull/13754

I'm not able to reproduce with the following:

Logs

``` Jasons-MacBook-Pro:temp jason$ npx -p @nrwl/schematics@7.5.0 create-nx-workspace workspace3 npx: installed 126 in 2.795s Creating a sandbox with the CLI and Nx Schematics... [fsevents] Success: "/private/var/folders/pp/6fpj190128n9p41xm8g30rg80000gn/T/tmp-761477Mom7GzvRj3/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote added 451 packages from 242 contributors and audited 16340 packages in 6.808s found 0 vulnerabilities ng new "workspace3" --collection=@nrwl/schematics ? Which stylesheet format would you like to use? SCSS [ http://sass-lang.com ] ? What is the npm scope you would like to use for your Nx Workspace? ? Which Package Manager would you like to use for your workspace? npm CREATE workspace3/.prettierignore (57 bytes) CREATE workspace3/.prettierrc (25 bytes) CREATE workspace3/README.md (1862 bytes) CREATE workspace3/.editorconfig (245 bytes) CREATE workspace3/.gitignore (503 bytes) CREATE workspace3/angular.json (459 bytes) CREATE workspace3/karma.conf.js (1012 bytes) CREATE workspace3/nx.json (201 bytes) CREATE workspace3/package.json (2522 bytes) CREATE workspace3/tsconfig.json (427 bytes) CREATE workspace3/tslint.json (2307 bytes) CREATE workspace3/apps/.gitkeep (1 bytes) CREATE workspace3/libs/.gitkeep (0 bytes) CREATE workspace3/tools/tsconfig.tools.json (254 bytes) CREATE workspace3/tools/schematics/.gitkeep (0 bytes) npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor. > fsevents@1.2.7 install /Users/jason/projects/temp/temp/workspace3/node_modules/fsevents > node install node-pre-gyp WARN Using request for node-pre-gyp https download [fsevents] Success: "/Users/jason/projects/temp/temp/workspace3/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote > node-sass@4.10.0 install /Users/jason/projects/temp/temp/workspace3/node_modules/node-sass > node scripts/install.js Cached binary found at /Users/jason/.npm/node-sass/4.10.0/darwin-x64-64_binding.node > node-sass@4.10.0 postinstall /Users/jason/projects/temp/temp/workspace3/node_modules/node-sass > node scripts/build.js Binary found at /Users/jason/projects/temp/temp/workspace3/node_modules/node-sass/vendor/darwin-x64-64/binding.node Testing binary Binary is fine npm WARN @ngrx/effects@6.1.2 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ngrx/store@6.1.2 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ngrx/router-store@6.1.2 requires a peer of @angular/common@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ngrx/router-store@6.1.2 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ngrx/router-store@6.1.2 requires a peer of @angular/router@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ngtools/webpack@7.1.4 requires a peer of typescript@>=2.4.0 < 3.2 but none is installed. You must install peer dependencies yourself. npm WARN ajv-keywords@3.4.0 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself. added 1237 packages from 1203 contributors and audited 41394 packages in 19.861s found 2 vulnerabilities (1 low, 1 high) run `npm audit fix` to fix them, or `npm audit` for details Successfully initialized git. Jasons-MacBook-Pro:temp jason$ cd workspace3/ .editorconfig .prettierignore angular.json libs/ package-lock.json tsconfig.json .git/ .prettierrc apps/ node_modules/ package.json tslint.json .gitignore README.md karma.conf.js nx.json tools/ Jasons-MacBook-Pro:temp jason$ cd workspace3/ Jasons-MacBook-Pro:workspace3 jason$ yarn update yarn run v1.13.0 $ ng update @nrwl/schematics Updating package.json with dependency @nrwl/schematics @ "7.6.2" (was "7.5.0")... Updating package.json with dependency rxjs @ "6.4.0" (was "6.3.3")... Updating package.json with dependency @nrwl/nx @ "7.6.2" (was "7.5.0")... UPDATE package.json (2521 bytes) npm WARN @ngrx/effects@6.1.2 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ngrx/router-store@6.1.2 requires a peer of @angular/common@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ngrx/router-store@6.1.2 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ngrx/router-store@6.1.2 requires a peer of @angular/router@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ngrx/store@6.1.2 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ngtools/webpack@7.1.4 requires a peer of typescript@>=2.4.0 < 3.2 but none is installed. You must install peer dependencies yourself. npm WARN ajv-keywords@3.4.0 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself. added 11 packages from 6 contributors, updated 3 packages and audited 41396 packages in 12.266s found 2 vulnerabilities (1 low, 1 high) run `npm audit fix` to fix them, or `npm audit` for details Updating package.json with dependency @angular/cli @ "7.3.3" (was "7.2.4")... CREATE .vscode/extensions.json (115 bytes) UPDATE package.json (2577 bytes) UPDATE angular.json (642 bytes) npm WARN lifecycle The node binary used for scripts is /var/folders/pp/6fpj190128n9p41xm8g30rg80000gn/T/yarn--1551205596996-0.34384542741532864/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. > node-sass@4.11.0 install /Users/jason/projects/temp/temp/workspace3/node_modules/node-sass > node scripts/install.js Cached binary found at /Users/jason/.npm/node-sass/4.11.0/darwin-x64-64_binding.node > node-sass@4.11.0 postinstall /Users/jason/projects/temp/temp/workspace3/node_modules/node-sass > node scripts/build.js Binary found at /Users/jason/projects/temp/temp/workspace3/node_modules/node-sass/vendor/darwin-x64-64/binding.node Testing binary Binary is fine added 21 packages from 11 contributors, removed 27 packages, updated 72 packages, moved 5 packages and audited 42599 packages in 20.905s found 1 low severity vulnerability run `npm audit fix` to fix them, or `npm audit` for details ✨ Done in 60.49s. Jasons-MacBook-Pro:workspace3 jason$ cat package.json { "name": "workspace3", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "./node_modules/.bin/nx lint && ng lint", "e2e": "ng e2e", "affected:apps": "./node_modules/.bin/nx affected:apps", "affected:libs": "./node_modules/.bin/nx affected:libs", "affected:build": "./node_modules/.bin/nx affected:build", "affected:e2e": "./node_modules/.bin/nx affected:e2e", "affected:test": "./node_modules/.bin/nx affected:test", "affected:lint": "./node_modules/.bin/nx affected:lint", "affected:dep-graph": "./node_modules/.bin/nx affected:dep-graph", "affected": "./node_modules/.bin/nx affected", "format": "./node_modules/.bin/nx format:write", "format:write": "./node_modules/.bin/nx format:write", "format:check": "./node_modules/.bin/nx format:check", "update": "ng update @nrwl/schematics", "update:check": "ng update", "workspace-schematic": "./node_modules/.bin/nx workspace-schematic", "dep-graph": "./node_modules/.bin/nx dep-graph", "help": "./node_modules/.bin/nx help" }, "private": true, "dependencies": { "@angular/animations": "^7.0.0", "@angular/common": "^7.0.0", "@angular/compiler": "^7.0.0", "@angular/core": "^7.0.0", "@angular/forms": "^7.0.0", "@angular/platform-browser": "^7.0.0", "@angular/platform-browser-dynamic": "^7.0.0", "@angular/router": "^7.0.0", "core-js": "^2.5.4", "rxjs": "~6.4.0", "zone.js": "^0.8.26", "@nrwl/nx": "7.6.2", "@ngrx/effects": "7.2.0", "@ngrx/router-store": "7.2.0", "@ngrx/store": "7.2.0" }, "devDependencies": { "@angular/cli": "7.3.1", "@angular/compiler-cli": "^7.0.0", "@angular/language-service": "^7.0.0", "@angular-devkit/build-angular": "~0.13.1", "@ngrx/store-devtools": "7.2.0", "ngrx-store-freeze": "0.2.4", "@nrwl/schematics": "7.6.2", "jasmine-marbles": "0.4.0", "@types/jasmine": "~2.8.6", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "codelyzer": "~4.5.0", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~3.0.0", "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", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.11.0", "typescript": "~3.2.2", "prettier": "1.15.2", "dotenv": "6.2.0", "@ngrx/schematics": "7.2.0" } } Jasons-MacBook-Pro:workspace3 jason$ npm ls @angular/cli workspace3@0.0.0 /Users/jason/projects/temp/temp/workspace3 └── @angular/cli@7.3.1 ```

Itrulia commented 5 years ago

@FrozenPandaz my CLI is 7.3.1 aswell and for lib I get the same error for app I get

➜  frontend git:(nx-workspaces) ✗ ng g @nrwl/schematics:application testapp
? In which directory should the application be generated?
? Would you like to add Angular routing? No
? Which stylesheet format would you like to use? SCSS   [ http://sass-lang.com   ]
? 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)
Cannot read property 'types' of undefined

I also can't create a fresh workspace anymore since I get the following error Cannot find module '@angular-devkit/schematics' which is probably related to the breaking change?

So I can't try a fresh workspace (I also tried to do npm install -g @angular/cli@7.3.1)

So should we lock @nrwl/schematics to 7.5.0?

merobal commented 5 years ago

Version 7.3.4 for Angular CLI fixed the issue on our side (generating lib inside an existing repo).

arjunyel commented 5 years ago

I can also confirm cli version 7.3.4 fixed the issue for me generating a new app in a repo

FrozenPandaz commented 5 years ago

Good to hear :) Thanks for checking!

phpgeekfr commented 5 years ago

Still having the same issue with angular 8 and nrwl 8.0.0

Angular CLI: 8.0.3
Node: 10.16.0
OS: linux x64

What I get:

ng g @nrwl/angular:app catalog
Path "/catalog/e2e/src/app.e2e-spec.ts" does not exist.
MarcGilbertSparte commented 5 years ago

Same here, I've tried lots of things but I can't get it working.

I had :

Currently I'm running : @angular/cli 7.3.4 node 8.13 (tried 10.16 and 12.16 : got Path "/apps/web/vector-e2e/tsconfig.e2e.json" does not exist for both) @nrwl/schematics 7.6.2

But I tried everything I found online and nothing works. Please help ?

Update : I did it manually in the end.

dbigintonpro commented 5 years ago

Try uninstall @angular/pwa:

I have had a similar experience, using Angular CLI v8 and NX v8. It turns out the issue is related to @angular/pwa. To test, removing the @angular/pwa temporarily, then performing the app generation, and finally reinstalling @angular/pwa solved the issue for me.

npm uninstall @angular/pwa ng g @nrwl/angular:application vision npm install @angular/pwa

Nrwl - is there anyway to resolve this issue in the schematics?

ctaepper commented 5 years ago

@intuvision I was very hopeful, but your workaround doesn't work for me :(

ctaepper commented 5 years ago
ng g @nrwl/angular:app catalog
Path "/catalog/e2e/src/app.e2e-spec.ts" does not exist.

something is trying to use an angular-cli path instead of an nx path. the nx cli should be generating /apps/catalog-e2e/src/app.e2e-spec.ts

dbigintonpro commented 5 years ago

@ctaepper sorry to hear that. Wish I had something further to assist.

cpkthompson commented 5 years ago

Try this: check for "newProjectRoot" in the angular.json and remove it entirely

nivrith commented 5 years ago

@cpkthompson This worked for me! Thankyou

Try this: check for "newProjectRoot" in the angular.json and remove it entirely

mohammedzamakhan commented 5 years ago

@cpkthompson that resulted in a new error for me

Cannot read property 'forEach' of undefined
mohammedzamakhan commented 5 years ago

@FrozenPandaz even locking to 7.3.1 doesn't work for me 😢 I have used ng add @nrwl/workspace in my Angular CLI app

fen89 commented 4 years ago

I experienced this issue last week as well: ng g lib ui resulted in an Path "/libs/ui/src/lib/ui.service.spec.ts" does not exist.error. After removing old schematics from the angular.json file everything worked again as expected (longger version here for reference: https://github.com/nrwl/nx/issues/1937#issuecomment-544377735_)

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.