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 16.9.x errors with Cannot read properties of undefined (reading 'executor') #667

Closed
2 tasks
moniuch opened this issue Sep 23, 2023 · 23 comments
Closed
2 tasks
Labels
bug Something isn't working

Comments

@moniuch
Copy link

moniuch commented Sep 23, 2023

Please provide the environment you discovered this bug in.

Trying to follow the Get Started instructions

Now using node v18.18.0 (npm v9.8.1)
❯ npm create analog@latest
✔ Project name: … analog-start4
✔ Select a template: › Analog
✔ Select a variant: › angular-v16
✔ Would you like to add Tailwind to your project? … no

❯ npm run start

> [email protected] start
> npm run dev

> [email protected] dev
> ng serve

An unhandled exception occurred: Cannot read properties of undefined (reading 'executor')
See "/private/var/folders/k9/y9051znd5zbbryyktpbltq940000gn/T/ng-46KxxG/angular-errors.log" for further details.

Which area/package is the issue in?

create-analog

Description

as above

Please provide the exception or error you saw

No response

Other information

macOS 13.3

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@moniuch moniuch added the bug Something isn't working label Sep 23, 2023
@pratheeshrussell
Copy link

pratheeshrussell commented Sep 24, 2023

Facing the same issue on windows 10.

I downgraded the following package
"@nx/angular": "16.6.0",

and the following dev dependencies
"@nx/vite": "16.6.0",
"nx": "16.6.0",

You could try this workaround for now.

@moniuch
Copy link
Author

moniuch commented Sep 24, 2023

Thanks @pratheeshrussell - this indeed helped, will try a similar workaround with the nx workspace starter (which also failed for me)

@brandonroberts
Copy link
Member

Interesting. Something must have changed with Nx 16.9. Will take a look and check with the Nx team

@brandonroberts
Copy link
Member

brandonroberts commented Sep 24, 2023

I just tried this with node 18.17.1 and the latest version of Nx (16.9.0)

npm create analog@latest analog-nx-169
cd analog-nx-169
npm i
npx ng serve

And I'm not seeing the issue. I'm on OSX 12.8.x though

@moniuch
Copy link
Author

moniuch commented Sep 24, 2023

@brandonroberts Thanks for looking into it!

Let me ask this silly question: is Nx installed globally required for this to run?

I am on nvm, node 18.18 installed yesterday, I don't have Nx or any other packages installed globally there.

An unhandled exception occurred: Cannot read properties of undefined (reading 'executor')
See "/private/var/folders/k9/y9051znd5zbbryyktpbltq940000gn/T/ng-FjBxYV/angular-errors.log" for further details.

Tried with Node 18.18 and 18.17.1 - no difference

@brandonroberts
Copy link
Member

@moniuch no, Nx is not globally required for this to run. Can you paste the complete error log?

@moniuch
Copy link
Author

moniuch commented Sep 24, 2023

@brandonroberts HTH

[error] TypeError: Cannot read properties of undefined (reading 'executor')
    at readTargetOptions (/Users/owner/analog-nx-169-18171/node_modules/@nx/devkit/src/executors/read-target-options.js:24:60)
    at getNxTargetOptions (/Users/owner/analog-nx-169-18171/node_modules/@nx/vite/src/utils/options-utils.js:137:42)
    at viteDevServerExecutor (/Users/owner/analog-nx-169-18171/node_modules/@nx/vite/src/executors/dev-server/dev-server.impl.js:24:69)
    at viteDevServerExecutor.next (<anonymous>)
    at recurse (/Users/owner/analog-nx-169-18171/node_modules/@nx/devkit/src/utils/convert-nx-executor.js:61:26)
    at /Users/owner//analog-nx-169-18171/node_modules/@nx/devkit/src/utils/convert-nx-executor.js:78:17

@brandonroberts
Copy link
Member

@AgentEnder any ideas here?

@AgentEnder
Copy link

Nothing jumps out at me as a 16.9 change that could have affected this. Have you been able to repro at all?

@brandonroberts
Copy link
Member

I haven't been able to, but I'm on an older version of OSX

@pratheeshrussell
Copy link

pratheeshrussell commented Sep 25, 2023

I checked this on a Ubuntu machine with node 18.17.1. The same issue occurs

Error occurs in the following file
node_modules/@nx/devkit/src/executors/read-target-options.js

The error occurs in line 24
image

since targetConfiguration is undefined.

I console logged projectConfiguration and saw that the following targets were available build, serve, test
however, the target is coming as 'my-app'

running the following command runs the app
npm run dev -- --build-target build

but the following fails with a different error message
npm run dev -- --build-target serve

@AgentEnder
Copy link

Can you link a reproduction link for this?

@pratheeshrussell
Copy link

I just created a new project with
npm create [email protected]

and then installed dependencies and ran
npm run start

Node Version: v18.17.1
Npm Version: 9.6.7
OS: Ubuntu 20.04.6 LTS (also tried separately in Windows 10 earlier)

https://github.com/pratheeshrussell/analog-bug-test

@zajcman
Copy link

zajcman commented Sep 28, 2023

The same problem on Windows 11 Pro

My error log:

[error] TypeError: Cannot read properties of undefined (reading 'executor')
at readTargetOptions (\node_modules.pnpm@[email protected][email protected]\node_modules@nx\devkit\src\executors\read-target-options.js:24:60)
at getNxTargetOptions (\node_modules.pnpm@nx+vite@16.9.1_@types[email protected][email protected][email protected][email protected][email protected]\node_modules@nx\vite\src\utils\options-utils.js:137:42)
at viteDevServerExecutor (\node_modules.pnpm@nx+vite@16.9.1_@types[email protected][email protected][email protected][email protected][email protected]\node_modules@nx\vite\src\executors\dev-server\dev-server.impl.js:24:69)
at viteDevServerExecutor.next ()
at recurse (\node_modules.pnpm@[email protected][email protected]\node_modules@nx\devkit\src\utils\convert-nx-executor.js:61:26)
at \node_modules.pnpm@[email protected][email protected]\node_modules@nx\devkit\src\utils\convert-nx-executor.js:78:17

@luisbytes
Copy link

@brandonroberts
Copy link
Member

Can someone try with the latest release? 0.2.51

@pratheeshrussell
Copy link

pratheeshrussell commented Oct 1, 2023

Can someone try with the latest release? 0.2.51

The issue exists in the latest release too @brandonroberts

For now I am running it with npm run dev -- --build-target build

@SOG-web
Copy link
Contributor

SOG-web commented Oct 2, 2023

Am also having thesame issue just now

this is my deps

"dependencies": {
    "@analogjs/content": "^0.2.0",
    "@analogjs/router": "^0.2.0",
    "@angular/animations": "^16.2.0",
    "@angular/common": "^16.2.0",
    "@angular/compiler": "^16.2.0",
    "@angular/core": "^16.2.0",
    "@angular/forms": "^16.2.0",
    "@angular/platform-browser": "^16.2.0",
    "@angular/platform-browser-dynamic": "^16.2.0",
    "@angular/platform-server": "^16.2.0",
    "@angular/router": "^16.2.0",
    "@nx/angular": "^16.7.0",
    "front-matter": "^4.0.2",
    "marked": "^5.0.2",
    "marked-gfm-heading-id": "^3.1.0",
    "marked-highlight": "^2.0.1",
    "mermaid": "^10.2.4",
    "prismjs": "^1.29.0",
    "rxjs": "~7.5.6",
    "tslib": "^2.4.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@analogjs/platform": "^0.2.0",
    "@angular-devkit/build-angular": "^16.2.0",
    "@angular/cli": "^16.2.0",
    "@angular/compiler-cli": "^16.2.0",
    "@nx/vite": "^16.7.0",
    "nx": "^16.7.0",
    "jsdom": "^22.1.0",
    "typescript": "~5.0.2",
    "vite": "^4.4.8",
    "vitest": "^0.32.0",
    "tailwindcss": "^3.3.1",
    "postcss": "^8.4.21",
    "autoprefixer": "^10.4.14"
  }

I generated the app with npm create analog@latest

@SOG-web
Copy link
Contributor

SOG-web commented Oct 2, 2023

when I run it with npm run dev -- --build-target build

i get an error

2:28:17 PM [vite] Error when evaluating SSR module /node_modules/@angular/core/fesm2022/core.mjs: failed to import "rxjs"
|- TypeError: Method Promise.prototype.then called on incompatible receiver [object Object]
    at ZoneAwarePromise.then (<anonymous>)
    at node:internal/per_context/primordials:440:35
    at new Promise (<anonymous>)
    at new SafePromise (node:internal/per_context/primordials:408:29)
    at node:internal/per_context/primordials:440:9
    at Array.map (<anonymous>)
    at arrayToSafePromiseIterable (node:internal/per_context/primordials:437:5)
    at node:internal/per_context/primordials:453:21
    at new Promise (<anonymous>)
    at primordials.SafePromiseAll (node:internal/per_context/primordials:452:3)

2:28:17 PM [vite] Error when evaluating SSR module ~analog/entry-server: failed to import "/node_modules/@angular/core/fesm2022/core.mjs"
|- TypeError: Method Promise.prototype.then called on incompatible receiver [object Object]
    at ZoneAwarePromise.then (<anonymous>)
    at node:internal/per_context/primordials:440:35
    at new Promise (<anonymous>)
    at new SafePromise (node:internal/per_context/primordials:408:29)
    at node:internal/per_context/primordials:440:9
    at Array.map (<anonymous>)
    at arrayToSafePromiseIterable (node:internal/per_context/primordials:437:5)
    at node:internal/per_context/primordials:453:21
    at new Promise (<anonymous>)
    at primordials.SafePromiseAll (node:internal/per_context/primordials:452:3)

@brandonroberts
Copy link
Member

@SOG-web that's a separate issue. You must be on Node >= 18.13.0

@SOG-web
Copy link
Contributor

SOG-web commented Oct 2, 2023

@SOG-web that's a separate issue. You must be on Node >= 18.13.0

oh, yes I forgot to change my node version. since am using nvm. Thanks it working now

but not the normal ng serve

I guess the ng serve issue seems to be from nx, But I have tried downgrading the nx version up 16.5.0, it does not work

@brandonroberts
Copy link
Member

@AgentEnder I'm able to reproduce this on a new project also, here's a screenshot of what's being logged and where the error occurs

image

Pinning all the nx packages (@nx/angular,@nx/vite, nx) to 16.8.1 resolves the issue for now.

@brandonroberts brandonroberts pinned this issue Oct 3, 2023
@brandonroberts brandonroberts changed the title Trying to run first analog project leads to Cannot read properties of undefined (reading 'executor') Nx 16.9.x errors with Cannot read properties of undefined (reading 'executor') Oct 3, 2023
@brandonroberts
Copy link
Member

This looks to have been resolved with the latest release of Nx. Please verify and re-open if that's not the case

@brandonroberts brandonroberts unpinned this issue Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants