nx: Cannot generate new angular app in existing nx workspace

Current Behavior

I have a working nx workspace with 1 angular app and multiple libs. I am on latest angular v15.2 and nx v15.8.1 Tried generating a new angular app but got error. image `

Expected Behavior

Generating a new angular app inside existing nx workspace works

GitHub Repo

No response

Steps to Reproduce

  1. Run command nx g @nrwl/angular:application my-app inside existing nx workspace

Nx Report

nx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.14.0
   OS   : win32 x64
   npm  : 9.3.1

   nx                      : 15.8.1
   @nrwl/js                : 15.8.1
   @nrwl/jest              : 15.8.1
   @nrwl/linter            : 15.8.1
   @nrwl/workspace         : 15.8.1
   @nrwl/angular           : 15.8.1
   @nrwl/cli               : 15.8.1
   @nrwl/cypress           : 15.8.1
   @nrwl/devkit            : 15.8.1
   @nrwl/eslint-plugin-nx  : 15.8.1
   @nrwl/nx-plugin         : 15.8.1
   @nrwl/rollup            : 15.8.1
   @nrwl/storybook         : 15.8.1
   @nrwl/tao               : 15.8.1
   @nrwl/web               : 15.8.1
   @nrwl/webpack           : 15.8.1
   @nrwl/nx-cloud          : 15.1.1
   typescript              : 4.9.5
   ---------------------------------------
   Community plugins:
   ngx-build-plus     : 15.0.0
   @compodoc/compodoc : 1.1.19
   @storybook/angular : 6.5.16
   ---------------------------------------
   Local workspace plugins:
         @fiyu/lib-toolkit

Failure Logs

nx g @nrwl/angular:application cool-app --dry-run --verbose

>  NX  Generating @nrwl/angular:application

√ Would you like to configure routing for this application? (y/N) · false
√ Would you like to use Standalone Components? (y/N) · false

 >  NX   Cannot find configuration for 'cool-app'


Error: Cannot find configuration for 'cool-app'
    at readProjectConfiguration (C:\Git\projects\fiyu\frontend\node_modules\nx\src\generators\utils\project-configuration.js:88:15)
    at updateAppAndE2EProjectConfigurations (C:\Git\projects\fiyu\frontend\node_modules\@nrwl\angular\src\generators\application\lib\update-config-files.js:29:57)
    at updateConfigFiles (C:\Git\projects\fiyu\frontend\node_modules\@nrwl\angular\src\generators\application\lib\update-config-files.js:12:5)
    at C:\Git\projects\fiyu\frontend\node_modules\@nrwl\angular\src\generators\application\application.js:56:37
    at Generator.next (<anonymous>)
    at fulfilled (C:\Git\projects\fiyu\frontend\node_modules\tslib\tslib.js:164:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

@leosvelperez but based on this guide, you can have the property there to run root-level scripts (which was my case) and it should work. Am I missing something?

Yeah if i remember correctly i added nx prop because of that feature when i saw it in release blog post but never used it so far

@aleix10kst you’re correct. That’s what I said I’ll take a look later. I closed this because the OP wasn’t using that and their issue was solved. I’ll reopen it to track what you mention.

I have the same issue. Nx version: 15.8.1

At the: ‘nx@15.8.1/node_modules/nx/src/generators/utils/project-configuration.js’ it looks for ‘angular.json’ file which was removed when the migrations were run.

function readProjectConfiguration(tree, projectName) {
    const allProjects = readAndCombineAllProjectConfigurations(tree);
    if (!allProjects[projectName]) {
        // temporary polyfill to make sure our generators work for existing angularcli workspaces
        if (tree.exists('angular.json')) {
            const angularJson = toNewFormat((0, json_1.readJson)(tree, 'angular.json'));
            if (angularJson.projects[projectName])
                return angularJson.projects[projectName];
        }
        throw new Error(`Cannot find configuration for '${projectName}'`);
    }
    return allProjects[projectName];
}