nrwl / nx

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

Building Angular application produces many warning "Project extension with invalid name found" #11138

Closed minijus closed 2 years ago

minijus commented 2 years ago

Current Behavior

Building Angular application produces many warning:

Project extension with invalid name found.

The warning is thrown from: https://github.com/angular/angular-cli/blob/main/packages/angular_devkit/core/src/workspace/json/reader.ts#L205

name is not logged when running Angular builder from nx cli. However, when debugging names that produce warnings are $schema, configFilePath, tags.

image image

Expected Behavior

There should be no such warnings.

Steps to Reproduce

Build Angular application with latest version on nrwl/nx and Angular (v14.0.6).

Environment

 >  NX   Report complete - copy this into the issue template

   Node : 16.16.0
   OS   : darwin x64
   npm  : 8.14.0

   nx : 14.4.2
   @nrwl/angular : 14.4.2
   @nrwl/cypress : 14.4.2
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.4.2
   @nrwl/eslint-plugin-nx : 14.4.2
   @nrwl/express : Not Found
   @nrwl/jest : 14.4.2
   @nrwl/js : 14.4.2
   @nrwl/linter : 14.4.2
   @nrwl/nest : 14.4.2
   @nrwl/next : Not Found
   @nrwl/node : 14.4.2
   @nrwl/nx-cloud : 14.2.0
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.4.2
   @nrwl/web : 14.4.2
   @nrwl/workspace : 14.4.2
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:
         @ngrx/effects: 14.0.2
         @ngrx/entity: 14.0.2
         @ngrx/router-store: 14.0.2
         @ngrx/schematics: 14.0.2
         @ngrx/store: 14.0.2
         @ngrx/store-devtools: 14.0.2
leosvelperez commented 2 years ago

Thank for reporting this!

We are aware of this issue, and we're looking into it. It's something that started to appear in Angular CLI v14.0.6, which was released yesterday. Please note that it doesn't really cause any issues apart from the noisy logs.

wstidolph commented 2 years ago

Possibly related, the angular material schematic doesn't work:

ng add @angular/material
Ng add is not natively supported by Nx
Instead, we recommend running `npm install @angular/material && npx nx g @angular/material:ng-add`
...
 NX  Generating @angular/material:ng-add
...
Packages installed successfully.
Project extension with invalid name found.
Project extension with invalid name found.
SchematicsException [Error]: Project name is required.
    at getProjectFromWorkspace (/Users/waynestidolph/dev/inphoto/node_modules/@angular/cdk/schematics/utils/get-project.js:20:15)
    at /Users/waynestidolph/dev/inphoto/node_modules/@angular/material/schematics/ng-add/setup-project.js:29:66
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

 >  NX   Project name is required.

   Pass --verbose to see the stacktrace.

node:internal/errors:856
  const err = new Error(message);
              ^

Error: Command failed: npm install @angular/material && npx nx g @angular/material:ng-add
    at checkExecSyncError (node:child_process:820:11)
    at execSync (node:child_process:891:15)
    at /Users/waynestidolph/dev/inphoto/node_modules/nx/bin/init-local.js:116:46
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 9938,
  stdout: null,
  stderr: null
}

Node.js v18.5.0

ng and nx versions are 14.4.2 macOS 12.4 same result if use node v14.20.0

Osendo commented 2 years ago

Possibly related, the angular material schematic doesn't work:

ng add @angular/material
Ng add is not natively supported by Nx
Instead, we recommend running `npm install @angular/material && npx nx g @angular/material:ng-add`
...
 NX  Generating @angular/material:ng-add
...
Packages installed successfully.
Project extension with invalid name found.
Project extension with invalid name found.
SchematicsException [Error]: Project name is required.
    at getProjectFromWorkspace (/Users/waynestidolph/dev/inphoto/node_modules/@angular/cdk/schematics/utils/get-project.js:20:15)
    at /Users/waynestidolph/dev/inphoto/node_modules/@angular/material/schematics/ng-add/setup-project.js:29:66
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

 >  NX   Project name is required.

   Pass --verbose to see the stacktrace.

node:internal/errors:856
  const err = new Error(message);
              ^

Error: Command failed: npm install @angular/material && npx nx g @angular/material:ng-add
    at checkExecSyncError (node:child_process:820:11)
    at execSync (node:child_process:891:15)
    at /Users/waynestidolph/dev/inphoto/node_modules/nx/bin/init-local.js:116:46
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 9938,
  stdout: null,
  stderr: null
}

Node.js v18.5.0

ng and nx versions are 14.4.2 macOS 12.4 same result if use node v14.20.0

It worked for me yarn add -W @angular/material && yarn nx g @angular/material:ng-add --project web macOS 12.4 node 16.11.0 nx 14.4.2 ng 14.0.6 But I had the same problem in the logs when serve app I think this problem may be related to this commit angular-cli 3d6ed0caf329dfefec13296c1b6a8a14d4096111

wstidolph commented 2 years ago

Ahh, I bet it's the --project web ... thanks! But I wish I'd seen that before I slogged through manually adding angular material ;)

nhhockeyplayer commented 2 years ago

Im seeing this in the feds module example for angular after nx migrate not sure if it survived migration still shaking it out

AgentEnder commented 2 years ago

The warnings can be ignored, I'm working on a PR to hide them now. Angular Devkit has surfaced a warning whenever workspace configuration contains fields it doesn't know about, in Nx workspaces this is things like tags, implicitDependencies etc

jon9090 commented 2 years ago

Any workarounds?

AgentEnder commented 2 years ago

There's not one needed, it's a warning you can ignore

VashJuan commented 2 years ago

Maybe I have something else going on, but my app (https://github.com/EOCOnline/rangertrak) compiled before I moved from 14.0.5 to 14.0.6. Now I'm getting a few of the warnings noted above, but I'm also getting just now getting "error NG8001: 'rangertrak-alerts' is not a known element" errors which is breaking my compilation. I'm otherwise pretty much evergreen - keeping my packages uptodate within a week or whatever of their release.

Looking at app.module.ts, the whole @NgModule({ imports:[...], section is getting the following error for each import

For instance, BrowserModule can't be imported as: Value at position 11 in the NgModule.imports of AppModule is not a reference Value could not be determined statically.(-991010) app.module.ts(78, 5): Unable to evaluate this expression statically. app.module.ts(78, 5): Unable to evaluate an invalid expression.

Maybe this is some latent error that just showed up for me??? (I'm still relying on others to create the scaffolding I work from)

ac4mm commented 2 years ago

It could be unleashed from the arguments "tags", "implicitDependencies" in angular.json, so i resolved problem (in Angular 14.0.6) removing properties from the angular.json.

rickhopkins commented 2 years ago

You could put a hack fix into the node_modules/@angular-devkit/core/src/workspace/json/reader.js file. Where you see lines 52 and 53 replace with:

const specialWorkspaceExtensions = ['cli', 'defaultProject', 'newProjectRoot', 'schematics', '$schema', 'implicitDependencies', 'configFilePath', 'tags'];
const specialProjectExtensions = ['cli', 'schematics', 'projectType', '$schema', 'implicitDependencies', 'configFilePath', 'tags'];

Only if it bothers you a ton... My OCD doesn't allow for things like this sometimes :) I've even written scripts to update files like this after npm install so that I don't have to see the warnings...

nhhockeyplayer commented 2 years ago

spotted this on a global build all

`nx run-many --all --target=build --parallel `

maybe its helpful feedback

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x7ffeea11de80
 1: 0x105c0dad2 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 2: 0x106bb42c3 V8_Fatal(char const*, ...) [/usr/local/bin/node]

    ✖  nx run demo:build:production
       Project extension with invalid name (rootDir) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (implicitDependencies) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (rootDir) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (implicitDependencies) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (implicitDependencies) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (implicitDependencies) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (implicitDependencies) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (implicitDependencies) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (implicitDependencies) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (implicitDependencies) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (implicitDependencies) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
       Project extension with invalid name ($schema) found.
       Project extension with invalid name (tags) found.
       Project extension with invalid name (configFilePath) found.
maphe commented 2 years ago

Not sure if that's related but as I'm trying to upgrade my project to the recently released v14.5.1, I'm also getting a ton of these

Project extension with invalid name (tags) found.
Project extension with invalid name (configFilePath) found.

plus it fails

 ERROR  Failed to run update-tsconfig-target from @angular/cli. This workspace is NOT up to date!

 >  NX   Path "/tsconfig.json" does not exist.
bjornharvold commented 2 years ago

Not sure if that's related but as I'm trying to upgrade my project to the recently released v14.5.1, I'm also getting a ton of these

Project extension with invalid name (tags) found.
Project extension with invalid name (configFilePath) found.

plus it fails

 ERROR  Failed to run update-tsconfig-target from @angular/cli. This workspace is NOT up to date!

 >  NX   Path "/tsconfig.json" does not exist.

+1 for me when running migration from 13.x -> 14.x

kszafraniec commented 2 years ago

@maphe @bjornharvold I also had the issue with "Path "/tsconfig.json" does not exist.". The cause was that my tsconfig in root dir had custom name tsconfig.base.json. Workaround is to temporary rename this file to tsconfig.json, run that single migration (by manual modifying migrations.json to contain only that single migration) and changing name back to original.

Apart of that I also report multiple warnings "Project extension with invalid name XXXXX found."

pegaltier commented 2 years ago

Hello I also report multiple warnings after the update to Nx 14.5.1 " Project extension with invalid name ($schema) found. Project extension with invalid name (tags) found. Project extension with invalid name (implicitDependencies) found. Project extension with invalid name (generators) found. "

PointSingularity commented 2 years ago

Hello I also report multiple warnings after the update to Nx 14.5.1 " Project extension with invalid name ($schema) found. Project extension with invalid name (tags) found. Project extension with invalid name (implicitDependencies) found. Project extension with invalid name (generators) found. "

Same. After upgrading from 14.4.3 to 14.5.1, getting a bunch of errors for my Angular app, but everything still functions.

e-oz commented 2 years ago

I’ve updated one of my projects to 14.5.1, everything went smoothly. Yes, there are warnings, but 1) I don't think the Nx team can do anything about it except intercept the output and remove these warnings, but it's a very hacky and unreliable way - I don't think their coding standards will allow this level of hackiness; 2) I’m pretty sure developers are aware of the issue and there is no need to “bump” this thread - it’s not cool to hurry up them from our side.

its-ratikant commented 2 years ago

I got the below warning; it's brand new project I created:

Project extension with invalid name (tags) found. Project extension with invalid name (configFilePath) found. Project extension with invalid name ($schema) found. Project extension with invalid name (tags) found. Project extension with invalid name (implicitDependencies) found. Project extension with invalid name (configFilePath) found.

alexnoise79 commented 2 years ago

partially solved removing "$schema" and "tags" from any single project.json.

i still have "implicitDependencies" and "configFilePath" as invalid name.

muhammadawaisshaikh commented 2 years ago

After removing the $schema still getting those warnings 😞

Langstra commented 2 years ago

I believe that @AgentEnder is working on a fix. Maybe we should just wait for that and not post over and over again that 'it is broken'. Yes this message will occur as long as this issue has not been closed. Let's just chill and wait for AgentEnder 😎

muhammadawaisshaikh commented 2 years ago

Many thanks @AgentEnder. you rocked man. How we can adapt these changes now? should I update my Nx to latest with nx migrate latest ? @Langstra or @FrozenPandaz if you can also help please?

AgentEnder commented 2 years ago

This will be included in the next patch release, keep an eye out for it and migrate after its been released.

muhammadawaisshaikh commented 2 years ago

Many thanks @AgentEnder :)

muhammadawaisshaikh commented 2 years ago

It worked now smoothly, Thanks @AgentEnder I got this fix in 4.5.4

Michuu93 commented 2 years ago

It worked now smoothly, Thanks @AgentEnder I got this fix in 4.5.4

You mean 14.5.4? I have not noticed an improvement on version 14.5.4, I am waiting for the next release.

muhammadawaisshaikh commented 2 years ago

It worked now smoothly, Thanks @AgentEnder I got this fix in 4.5.4

You mean 14.5.4? I have not noticed an improvement on version 14.5.4, I am waiting for the next release.

@Michuu93 it's released in 4.5.3 earlier than 4.5.4. image

muhammadawaisshaikh commented 2 years ago

@Michuu93 you can do nx migrate latest and remove node_modules and package-lock.json file and run npm i and then npm start it's done.

Michuu93 commented 2 years ago

@muhammadawaisshaikh I'll check it out, but I think on 14.5.4 it was still there for me.

muhammadawaisshaikh commented 2 years ago

@muhammadawaisshaikh I'll check it out, but I think on 14.5.4 it was still there for me.

I tried migrating to latest today 1 hour ago and it’s done and working perfectly. You can give it a try.

Michuu93 commented 2 years ago

node v16.16.0 yarn 1.22.17 all nrwl dependencies 14.5.4

Migrations already done ("there are no migrations to run, so migrations.json has not been created"), node_modules/target/.angular deleted, fresh yarn install and I still have errors on build: Project extension with invalid name (generators) found. But before update to 14.5.4 I had other errors (for schema/tags and generators too).

Michuu93 commented 2 years ago

Maybe I have unnecessary "generators" in nx.json?

AgentEnder commented 2 years ago

It seems I might have missed a few fields. I'll get a PR put up that adds them.

johnny-mh commented 2 years ago

I'm using nx 14.5.4 but same issue occurred.

The error occurred when using @angular-devkit/build-angular executor

스크린샷 2022-08-12 10 29 04
 >  NX   Report complete - copy this into the issue template

   Node : 16.16.0
   OS   : darwin arm64
   npm  : 8.15.1

   nx : 14.5.4
   @nrwl/angular : 14.5.4
   @nrwl/cypress : 14.5.4
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.5.4
   @nrwl/eslint-plugin-nx : 14.5.4
   @nrwl/express : 14.5.4
   @nrwl/jest : 14.5.4
   @nrwl/js : 14.5.4
   @nrwl/linter : 14.5.4
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 14.5.4
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.5.4
   @nrwl/web : 14.5.4
   @nrwl/workspace : 14.5.4
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:
         @ngrx/effects: 14.0.0
         @ngrx/entity: 14.0.0
         @ngrx/store: 14.0.0
         @ngrx/store-devtools: 14.0.0
         @kc/devkit: 3.7.1
         @nguniversal/builders: 14.0.3
         @nguniversal/express-engine: 14.0.3
         @testing-library/angular: 12.0.2
         ngx-spinner: 14.0.0
AgentEnder commented 2 years ago

Make sure @angular-devkit/core is at 14.1.1 or higher

johnny-mh commented 2 years ago

@AgentEnder I've update @nguniveral/builder v14.0.3 to v14.1.0-rc.0 then resolve that messages. Thanks!

Michuu93 commented 2 years ago

@AgentEnder I have errors:

Project extension with invalid name ($schema) found.
Project extension with invalid name (tags) found.

when I'm using custom generator to create libs (tools/generators/workspace-generators.json).

AgentEnder commented 2 years ago

@Michuu93 nx report and npm ls @angular-devkit/core?

Michuu93 commented 2 years ago
   Node : 16.16.0
   OS   : linux x64
   yarn : 1.22.17

   nx : 14.5.1
   @nrwl/angular : 14.5.1
   @nrwl/cypress : 14.5.1
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.5.1
   @nrwl/eslint-plugin-nx : 14.5.1
   @nrwl/express : Not Found
   @nrwl/jest : 14.5.1
   @nrwl/js : 14.5.1
   @nrwl/linter : 14.5.1
   @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/schematics : Not Found
   @nrwl/storybook : 14.5.1
   @nrwl/web : 14.5.1
   @nrwl/workspace : 14.5.1
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:
         @ngrx/component-store: 14.0.2
         @ngrx/effects: 14.0.2
         @ngrx/router-store: 14.0.2
         @ngrx/schematics: 14.0.2
         @ngrx/store: 14.0.2
         @ngrx/store-devtools: 14.0.2
         @storybook/angular: 6.5.9
         ng-mocks: 14.1.0
├─┬ @angular-builders/custom-webpack@14.0.0
│ ├─┬ @angular-devkit/architect@0.1401.0
│ │ └── @angular-devkit/core@14.1.0 deduped
│ └── @angular-devkit/core@14.1.0
├─┬ @angular-devkit/build-angular@14.1.0
│ ├─┬ @angular-devkit/architect@0.1401.1 invalid: "0.1401.0" from node_modules/@angular-devkit/build-angular
│ │ └── @angular-devkit/core@14.1.1 deduped invalid: "14.1.0" from node_modules/@angular-devkit/build-angular
│ └── @angular-devkit/core@14.1.1 invalid: "14.1.0" from node_modules/@angular-devkit/build-angular
├─┬ @angular/cli@14.1.0
│ ├── @angular-devkit/core@14.1.0 deduped
│ ├─┬ @angular-devkit/schematics@14.1.0
│ │ └── @angular-devkit/core@14.1.0 deduped
│ └─┬ @schematics/angular@14.1.0
│   └── @angular-devkit/core@14.1.0 deduped
└─┬ @storybook/angular@6.5.9
  └── @angular-devkit/core@14.1.0 deduped

I will update @angular-devkit/build-angular and check again.

AgentEnder commented 2 years ago

This was fixed in Nx 14.5.4, so you'll need to update to it.

Michuu93 commented 2 years ago

I'm sorry my mistake, I was on an old branch... But on 14.5.4 i have error with:

Project extension with invalid name (generators) found.

as I mentioned before, soo I will wait for next patch release :) Thanks for all!

cskiwi commented 2 years ago

14.5.4 & 14.5.5 fixed the massive dump for me, however still getting: Project extension with invalid name (nx) found.

AgentEnder commented 2 years ago

Do you have a project.json file that has an "Nx" property in it?

cskiwi commented 2 years ago

@AgentEnder ah yea, I had the following in one of my project.json

{
...
  "tags": [],
  "nx": {
    "implicitDependencies": ["https://github.com/nuintun/node-adodb"]
  }
}

But I don't think this is correct (right?)

The reason I tried adding was that the module above is a windows only module. But the library can be used on linux just with one feature disabled.

AgentEnder commented 2 years ago

@AgentEnder ah yea, I had the following in one of my project.json

{
...
  "tags": [],
  "nx": {
    "implicitDependencies": ["https://github.com/nuintun/node-adodb"]
  }
}

But I don't think this is correct (right?)

The reason I tried adding was that the module above is a windows only module. But the library can be used on linux just with one feature disabled.

Yeah, that's not correct. Implicit dependencies should be a key at root, not under an Nx key for project.json. additionally, it takes project names so the URL you've added won't do anything and would probably throw once you've updated such that it's read.

jkossis commented 2 years ago

Still seeing this for namedInputs:

Project extension with invalid name (namedInputs) found.

AgentEnder commented 2 years ago

Ah, geeze. 🤦 I'll get that one added.

qortex commented 2 years ago

Can't pinpoint where it comes from, but having (only remaining):

Project extension with invalid name (configurations) found.

AFAIK I only use configurations property inside builder & serve project configs.

its-ratikant commented 2 years ago

@qortex can you try deleting node_modules and package-lock.json and do npm install and then check?