nrwl / nx

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

Unable to generate a new application in v14.5.5 #11629

Closed chriswoodie closed 2 years ago

chriswoodie commented 2 years ago

Current Behavior

Running npx nx generate @nrwl/angular:application foobar --no-interactive --dry-run doesn't generate a new application, instead it throws an error saying that the foobar project doesn't exist.

Expected Behavior

I expect it to generate a new application with the name "foobar". This is working in v14.3.2 but not in v14.5.5.

Steps to Reproduce

Create a workspace that use v14.5.5 and then try to generate a project either via the terminal or the Nx Console.

Failure Logs

>  NX  Generating @nrwl/angular:application

[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.
[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.
[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.
SchematicsException [Error]: Project "foobar" does not exist.
    at <redacted>/node_modules/@schematics/angular/component/index.js:99:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Environment

Node : 16.13.0 OS : darwin x64 npm : 8.1.0

nx : 14.5.5 @nrwl/angular : 14.5.5 @nrwl/cypress : 14.5.5 @nrwl/detox : Not Found @nrwl/devkit : 14.5.5 @nrwl/eslint-plugin-nx : 14.5.5 @nrwl/express : Not Found @nrwl/jest : 14.5.5 @nrwl/js : 14.5.5 @nrwl/linter : 14.5.5 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/nx-cloud : 14.3.0 @nrwl/nx-plugin : Not Found @nrwl/react : Not Found @nrwl/react-native : Not Found @nrwl/schematics : Not Found @nrwl/storybook : 14.5.5 @nrwl/web : 14.5.5 @nrwl/workspace : 14.5.5 typescript : 4.7.4

Local workspace plugins:

Community plugins: rxjs: 6.6.7 @nguniversal/builders: 13.0.2 @storybook/angular: 6.5.10

Coly010 commented 2 years ago

@skog-newglue Hey! Thanks for reporting this.

This issue seems to be resolved in the latest version of Nx.

Could you migrate to the latest version and try again?

npx nx migrate latest && npx nx migrate --run-migrations

chriswoodie commented 2 years ago

@Coly010 Hi, running the migrations throws this error:

 >  NX   Failed to run update-14.1.8 from @nrwl/storybook. This workspace is NOT up to date!
 >  NX   Cannot read properties of undefined (reading 'split')
Coly010 commented 2 years ago

In that case, it looks like your workspace is using mixed versions of packages which can create issues.

Can you run nx repair?

chriswoodie commented 2 years ago

@Coly010 It says everything is up to date.

>  NX   No changes were necessary. This workspace is up to date!

Which packages are you referring to?

Coly010 commented 2 years ago

I was referring to the Nrwl Packages :)

Can you share a repo containing a reproduction so I can take a closer look?

chriswoodie commented 2 years ago

@Coly010 Having trouble with reproducing this. Didn't get the same issue in the cloned repo when I removed all applications and libraries and then ran migrate. Even managed to run the generate application script there. I removed this from migrations.json in the actual repo:

    {
      "version": "14.1.8",
      "cli": "nx",
      "description": "Change storybook targets for Angular projects to use @storybook/angular executors",
      "factory": "./src/migrations/update-14-1-8/change-storybook-targets",
      "package": "@nrwl/storybook",
      "name": "update-14.1.8"
    },

and managed to run the migration scripts just fine. However, I can still not generate an application.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

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.