Updating from 8.9.0 to 8.10.0 to have no breaking changes and scripts execute same as before without modification, or to receive a meaningful error message.
Any commands for affected files ( affected:test, affected:lint, affected:apps) now produce an identical error after updating to latest
> nx affected:test
...\node_modules\@nrwl\workspace\node_modules\yargs\yargs.js:1109
else throw err
^
TypeError: Cannot read property 'name' of undefined
at ProjectGraphBuilder.addNode (...\node_modules\@nrwl\workspace\src\core\project-graph\project-graph-builder.js:15:25)
at addAffectedNodes (...\node_modules\@nrwl\workspace\src\core\affected-project-graph\affected-project-graph.js:39:13)
at ...\node_modules\@nrwl\workspace\src\core\affected-project-graph\affected-project-graph.js:33:9
at Array.forEach (<anonymous>)
at filterAffectedProjects (...\node_modules\@nrwl\workspace\src\core\affected-project-graph\affected-project-graph.js:32:25)
at Object.filterAffected (...\node_modules\@nrwl\workspace\src\core\affected-project-graph\affected-project-graph.js:21:12)
at Object.affected (...\node_modules\@nrwl\workspace\src\command-line\affected.js:19:36)
at Object.handler (...\node_modules\@nrwl\workspace\src\command-line\nx-commands.js:66:138)
at Object.runCommand (...\node_modules\@nrwl\workspace\node_modules\yargs\lib\command.js:235:44)
at Object.parseArgs [as _parseArgs] (...\node_modules\@nrwl\workspace\node_modules\yargs\yargs.js:1022:30)
Please provide detailed steps for reproducing the issue.
ng update @nrwl/workspace to go from 8.9.0 to 8.10.0Please provide any relevant information about your setup:
I get maximum call stack exceeded:
```› yarn affected:lint
yarn run v1.21.1
$ nx affected:lint
/.../node_modules/yargs/yargs.js:1133
else throw err
^
RangeError: Maximum call stack size exceeded
at /.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:20
at Array.forEach (
at addAffectedNodes (/.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:12)
at /.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:36
at Array.forEach (
at addAffectedNodes (/.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:12)
at /.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:36
at Array.forEach (
at addAffectedNodes (/.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:12)
at /.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:36
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```
I have same error
In 8.11.0 the error has been improved. Now it says Invalid project name is detected: moment
https://github.com/nrwl/nx/commit/0c7a9d3#diff-3d7fd504c78c121f5722de1bedbc0deeR74
repo to reproduce - https://github.com/zaverden/nx-affected-error/tree/affected-error
affected-error branchaffected command, for example yarn affected:appsSteps:
momentmasterdist folder (to remove nxdeps cache)affected commandThe source of a problem: getTouchedNpmPackages returns removed packages as touched, but createProjectGraph includes only actual nodes[type='npm']
@alfaproject try 8.11.0. Looks like commit https://github.com/nrwl/nx/commit/0c7a9d3 solves call stack issue.
I am also facing the same issue when I run affected:lint against my origin/develop. I did some digging and found out that's because I've removed a dependency from my package.json and origin/develop still has it listed in his dependencies, this should not break the affected command.
So the question is what should be the right action if someone has a dependency mismatch?
I am happy to work on this issue if someone can tell me what should be the expected action
I am using
@nrwl/angular : Not Found
@nrwl/cli : 8.11.0
@nrwl/cypress : 8.11.0
@nrwl/eslint-plugin-nx : 8.11.0
@nrwl/express : 8.11.0
@nrwl/jest : 8.10.1
@nrwl/linter : 8.11.0
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 8.11.0
@nrwl/react : 8.11.0
@nrwl/schematics : Not Found
@nrwl/tao : 8.11.0
@nrwl/web : 8.11.0
@nrwl/workspace : 8.11.0
typescript : 3.5.3
@zaverden it's true that there is no call stack exception anymore but now the affected commands don't seem to finish. Infinite loop it seems, so still unusable. ):
@raheelriax: interesting find: the same is valid for my case. I am seeing:
Invalid project name is detected: "@angular/http"
and indeed: master has that @angular/http as a dependency in package.json, whereas my branch removed that. I'm also on 8.11.0. I'm not really sure if I can be of help to solve this issue (will dig into code to see how it works), but can gladly help reproduce or verify the issue to help facilitate a fix!
@raheelriax problem will be solved if getTouchedNpmPackages stops returns packages which were removed.
JsonChange has a type field so you can check it.
Link to getTouchedNpmPackages: https://github.com/nrwl/nx/blob/e41b448085/packages/workspace/src/core/affected-project-graph/locators/npm-packages.ts#L17
I don't know what side effects this change can bring. But at least this is a good starting point
@zaverden same here 😕 , I also used a workaround on my local machine to get it to working but I am not sure about the expected actions or what it should actually do in these kind of scenarios.
Waiting for anyone from the Nx team or contributors to shed a light on this.
@zaverden I'm facing the same issue.
Can also confirm this bug:
For me works on my local machine (mac os 10.15) but breaks on our CI which uses ubuntu (but tried a run witch mac os which also breaks) with the error message:
Error: Invalid project name is detected: "time-ago-pipe"
where the package time-ago-pipe was removed
@Tre665 it works locally for you, because nx uses cache. It is located in dist folder.
Wild thought: if you commit your local dist/nxdeps.json file it'll be used on your CI machine. So, it may be a work around for you
@Tre665 for me its breaking on both CI and on my local machine (Mac OS X 10.15.2)
I'm also running into this bug after removing some dependencies. Removing the dist/ folder locally doesn't fix it. Output of yarn nx affected:build is: Error: Invalid project name is detected: "@ngx-translate/core". Seems to me that when no nx cache is found, the package.json is compared but still (wrongly) complains about a removed dependency.
I'll take a look. It will be patched in the next release.
@jaysoo Any estimate on when we can expect a release with this fix? This is halting our CICD pipeline.
@jaysoo @vsavkin Exactly the same problem as @jaunkst. CI is dead for now, because of that issue. Please, create a new release.
@kkuriata We are also facing the issue. As a temporary workaround we just re-added the package to keep them in sync with master and manage a list which dependency we have to remove when the fix is released.
It is not the best way, but at least our CI keeps working.
@Tre665 Yeah, I was thinking about that, too :)
8.11.1 was released and an upgrade resolved the CICD issues.
Thanks guys for resolving this issue so fast!
This issue still happens in NX 10.3.0 version
Most helpful comment
I'll take a look. It will be patched in the next release.