Skip to content
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

NX Ran target undefined for project #14158

Closed
jdpearce opened this issue Jan 5, 2023 · 9 comments · Fixed by #14238
Closed

NX Ran target undefined for project #14158

jdpearce opened this issue Jan 5, 2023 · 9 comments · Fixed by #14238
Assignees
Labels

Comments

@jdpearce
Copy link
Collaborator

jdpearce commented Jan 5, 2023

Current Behavior

From a new repo, if there are any failing tests in a Jest test suite, Nx outputs an error as in the title:

 >  NX   Ran target undefined for project todos (5s)

    ✖    1/1 failed
    ✔    0/1 succeeded [0 read from cache]

Expected Behavior

I would expect Nx to pick up the target correctly, i.e.

 >  NX   Ran target test for project todos (5s)

    ✖    1/1 failed
    ✔    0/1 succeeded [0 read from cache]

Github Repo

No response

Steps to Reproduce

  1. npx create-nx-workspace@latest --name=todos --preset=angular-monorepo --cli=nx --appName=todos --style=scss --nxCloud=false
  2. echo "describe('AppComponent', () => { it('should fail here', () => { expect(false).toBe(true); }); });" > ./todos/apps/todos/src/app/app.component.spec.ts
  3. cd todos && npx nx run todos:test

Nx Report

>  NX   Report complete - copy this into the issue template

   Node : 16.15.1
   OS   : darwin x64
   npm  : 8.11.0

   nx : 15.4.4
   @nrwl/angular : 15.4.4
   @nrwl/cypress : 15.4.4
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.4.4
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.4.4
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.4.4
   @nrwl/js : 15.4.4
   @nrwl/linter : 15.4.4
   @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/rollup : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/webpack : 15.4.4
   @nrwl/workspace : 15.4.4
   @nrwl/vite : Not Found
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:

Failure Logs

No response

Additional Information

No response

@wSedlacek
Copy link
Contributor

I have noticed this bug too when upgrading to 15.4.4

@bugrauluyurt
Copy link

bugrauluyurt commented Jan 8, 2023

Faced with the same bug. Here is my error when I put '--verbose':

 >  NX   undefined is not iterable (cannot read property Symbol(Symbol.iterator))
HookWebpackError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at makeWebpackError (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/webpack@5.75.0/node_modules/webpack/lib/HookWebpackError.js:48:9)
    at /Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/webpack@5.75.0/node_modules/webpack/lib/Compilation.js:3060:12
    at eval (eval at create (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:23:1)
    at fn (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/webpack@5.75.0/node_modules/webpack/lib/Compilation.js:480:17)
    at _next0 (eval at create (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:21:1)
    at eval (eval at create (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:34:1)
    at eval (eval at create (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at /Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/webpack@5.75.0/node_modules/webpack/lib/Compilation.js:502:10
    at Hook.eval [as callAsync] (eval at create (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/Hook.js:18:14)
-- inner error --
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at /Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/nx@15.4.5/node_modules/nx/src/lock-file/pnpm.js:228:31
    at Array.forEach (<anonymous>)
    at pruneDependencies (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/nx@15.4.5/node_modules/nx/src/lock-file/pnpm.js:225:184)
    at prunePnpmLockFile (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/nx@15.4.5/node_modules/nx/src/lock-file/pnpm.js:213:26)
    at createLockFile (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/nx@15.4.5/node_modules/nx/src/lock-file/lock-file.js:152:57)
    at /Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/@nrwl+webpack@15.4.5_eogilhn2m7vphbmr725wv6a7ry/node_modules/@nrwl/webpack/src/utils/generate-package-json-webpack-plugin.js:42:135
    at fn (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/webpack@5.75.0/node_modules/webpack/lib/Compilation.js:478:10)
    at _next0 (eval at create (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:21:1)
    at eval (eval at create (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:34:1)
    at eval (eval at create (/Users/bugra.uluyurt/Documents/sites/personal/highhammer/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)

@ms-tng
Copy link
Contributor

ms-tng commented Jan 9, 2023

I'm experiencing a similar issue when building a lib with the @nrwl/js:tsc executor.
It seems that at https://github.com/nrwl/nx/blob/master/packages/js/src/executors/tsc/tsc.impl.ts#L118 it tries to access context.projectsConfigurations where it should be context.workspace - at least patching it locally helped.

@AgentEnder
Copy link
Member

@bugrauluyurt & @ms-tng , it sounds like your alls issues are likely caused by out of sync versions. Can you run nx workspace-lint or nx report and double check that things are aligned as they should be?

@barbados-clemens
Copy link
Contributor

weirdly using --verbose flag the target name shows up and only happens when a target fails.

reproduced it with the build and test targets.

WkMacM1-3ZY3Zp29_01091052

@AgentEnder AgentEnder added the scope: core core nx functionality label Jan 9, 2023
@AgentEnder AgentEnder self-assigned this Jan 9, 2023
@bugrauluyurt
Copy link

bugrauluyurt commented Jan 9, 2023

@bugrauluyurt & @ms-tng , it sounds like your alls issues are likely caused by out of sync versions. Can you run nx workspace-lint or nx report and double check that things are aligned as they should be?

Here is my report. Linting did not show any output. Packages marked as 'Not Found' are expected. I don't need them. Or does Nx needs some of them somehow?

Thanks for helping out.

 >  NX   Report complete - copy this into the issue template

   Node : 18.13.0
   OS   : darwin x64
   pnpm : 7.22.0

   nx : 15.4.5
   @nrwl/angular : Not Found
   @nrwl/cypress : 15.4.5
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.4.5
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.4.5
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.4.5
   @nrwl/js : 15.4.5
   @nrwl/linter : 15.4.5
   @nrwl/nest : 15.4.5
   @nrwl/next : Not Found
   @nrwl/node : 15.4.5
   @nrwl/nx-cloud : 15.0.2
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 15.4.5
   @nrwl/react-native : Not Found
   @nrwl/rollup : 15.4.5
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : 15.4.5
   @nrwl/webpack : 15.4.5
   @nrwl/workspace : 15.4.5
   @nrwl/vite : 15.4.5
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:

@AgentEnder
Copy link
Member

Those versions look fine @bugrauluyurt. In any case, this issue is just for the showing of "undefined" as the target name, not anything that is actually causing failed commands. You should open a new issue that contains repro steps and more info as to what commands you are running.

@ms-tng
Copy link
Contributor

ms-tng commented Jan 10, 2023

@AgentEnder Thanks for the hint! nx workspace-lint indeed showed out-of-sync versions and aligning them fixed the issue.

@github-actions
Copy link

github-actions bot commented Mar 3, 2023

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 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants