Skip to content

Error when running affected:test with --parallel #700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AnyFlippingUsernameWillDo opened this issue Aug 11, 2018 · 3 comments · Fixed by #723
Closed

Error when running affected:test with --parallel #700

AnyFlippingUsernameWillDo opened this issue Aug 11, 2018 · 3 comments · Fixed by #723
Assignees

Comments

@AnyFlippingUsernameWillDo
Copy link

AnyFlippingUsernameWillDo commented Aug 11, 2018

Hi,
Apologies if this has been mentioned before or if I'm doing something stupid but I'm getting a "Cannot read property 'forEach' of undefined" when I try to run any of the affected commands with --parallel.
This is with version 6.2.0 but doesn't work with earlier versions.
Windows, Node v9.11.1

For example.

$ ./node_modules/.bin/nx affected:test a1d95f6dda5fd1a20f3ae3135255018d5cd825b1 f93c998bd93921b0cf4b639cea410a7a16a31b13 --parallel Testing a, b, c, d, e with flags: --no-watch
(node:15732) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'forEach' of undefined
    at C:\Projects\blah\node_modules\@nrwl\schematics\src\command-line\affected.js:237:33
    at step (C:\Projects\blah\node_modules\@nrwl\schematics\src\command-line\affected.js:40:23)
    at Object.throw (C:\Projects\blah\node_modules\@nrwl\schematics\src\command-line\affected.js:21:53)
    at rejected (C:\Projects\blah\node_modules\@nrwl\schematics\src\command-line\affected.js:13:65)
    at <anonymous>
(node:15732) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15732) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are
not handled will terminate the Node.js process with a non-zero exit code.
Done in 8.67s.

Without trying to run in parallel everything works fine.

If anyone could point me in the right direction to either fix or diagnose the problem I would be very grateful.

Thanks.

@AnyFlippingUsernameWillDo
Copy link
Author

Ah ... I have found the problem.
My upgraded project was missing the following from my package.json file

  "scripts": {
    "ng": "ng",

Adding that has fixed the issue.
I guess it might be nice if the error message was a little more helpful.

@kpaxton
Copy link
Contributor

kpaxton commented Aug 14, 2018

Having that as a requirement is not documented anywhere. There should at least be a fallback if that is not present.

I just ran into this same issue and that's a bit frustrating that I have to have a pointless reference in the package.json for this to work.

bcabanes added a commit to bcabanes/nx that referenced this issue Aug 21, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
When running the affected command with the `--parallel` option, `npm-run-all` is used to achieve the parallel execution of the desired tasks. Because of the use of `npm-run-all`, the `ng` command should be visible and declared as script command in the `package.json` of your project.

This adds a verification before runing the command with the `--parallel` option to make sure the `package.json` has the `ng: "ng"` command in the `scripts` section.

close nrwl#700
bcabanes added a commit to bcabanes/nx that referenced this issue Aug 21, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
When running the affected command with the `--parallel` option, `npm-run-all` is used to achieve the parallel execution of the desired tasks. Because of the use of `npm-run-all`, the `ng` command should be visible and declared as script command in the `package.json` of your project.

This adds a verification before runing the command with the `--parallel` option to make sure the `package.json` has the `ng: "ng"` command in the `scripts` section.

close nrwl#700
bcabanes added a commit to bcabanes/nx that referenced this issue Aug 23, 2018

Verified

This commit was signed with the committer’s verified signature.
FrozenPandaz Jason Jean
When running the affected command with the `--parallel` option, `npm-run-all` is used to achieve the parallel execution of the desired tasks. Because of the use of `npm-run-all`, the `ng` command should be visible and declared as script command in the `package.json` of your project.

This adds a verification before runing the command with the `--parallel` option to make sure the `package.json` has the `ng: "ng"` command in the `scripts` section.

close nrwl#700
bcabanes added a commit to bcabanes/nx that referenced this issue Aug 23, 2018
When running the affected command with the `--parallel` option, `npm-run-all` is used to achieve the parallel execution of the desired tasks. Because of the use of `npm-run-all`, the `ng` command should be visible and declared as script command in the `package.json` of your project.

This adds a verification before runing the command with the `--parallel` option to make sure the `package.json` has the `ng: "ng"` command in the `scripts` section.

close nrwl#700
bcabanes added a commit to bcabanes/nx that referenced this issue Aug 23, 2018
When running the affected command with the `--parallel` option, `npm-run-all` is used to achieve the parallel execution of the desired tasks. Because of the use of `npm-run-all`, the `ng` command should be visible and declared as script command in the `package.json` of your project.

This adds a verification before runing the command with the `--parallel` option to make sure the `package.json` has the `ng: "ng"` command in the `scripts` section.

close nrwl#700
vsavkin pushed a commit that referenced this issue Aug 23, 2018
When running the affected command with the `--parallel` option, `npm-run-all` is used to achieve the parallel execution of the desired tasks. Because of the use of `npm-run-all`, the `ng` command should be visible and declared as script command in the `package.json` of your project.

This adds a verification before runing the command with the `--parallel` option to make sure the `package.json` has the `ng: "ng"` command in the `scripts` section.

close #700
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants