nx: affected: commands break in 8.10.0
Expected Behavior
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.
Current Behavior
Any commands for affected files ( affected:test, affected:lint, affected:apps) now produce an identical error after updating to latest
Failure Information (for bugs)
> 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)
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- run
ng update @nrwl/workspaceto go from 8.9.0 to 8.10.0 - from feature branch run nx affected:test and receive error
Context
Please provide any relevant information about your setup:
- Nx 8.10.0
- Angular 8.2.14
- npm 6.13.1
- node 13.3.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 12
- Comments: 24 (4 by maintainers)
Commits related to this issue
- fix(core): handle removed npm package for affected logic Closes #2274 — committed to jaysoo/nx by jaysoo 4 years ago
- fix(core): handle removed npm package for affected logic Closes #2274 — committed to jaysoo/nx by jaysoo 4 years ago
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.
@raheelriax problem will be solved if
getTouchedNpmPackagesstops returns packages which were removed.JsonChangehas atypefield 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#L17I don’t know what side effects this change can bring. But at least this is a good starting point
I get maximum call stack exceeded:
This issue still happens in NX 10.3.0 version
8.11.1 was released and an upgrade resolved the CICD issues.
@raheelriax: interesting find: the same is valid for my case. I am seeing:
Invalid project name is detected: "@angular/http"and indeed:
masterhas that@angular/httpas a dependency inpackage.json, whereas my branch removed that. I’m also on8.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!I am also facing the same issue when I run
affected:lintagainst my origin/develop. I did some digging and found out that’s because I’ve removed a dependency from mypackage.jsonand 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
repo to reproduce - https://github.com/zaverden/nx-affected-error/tree/affected-error
affected-errorbranchaffectedcommand, for exampleyarn affected:appsSteps:
momentmasterdistfolder (to remove nxdeps cache)affectedcommandThe source of a problem:
getTouchedNpmPackagesreturns removed packages as touched, butcreateProjectGraphincludes only actual nodes[type=‘npm’]