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

Error: Unable to resolve @nrwl/node:execute. #9168

Closed
icastillejogomez opened this issue Mar 3, 2022 · 37 comments · Fixed by #9184
Closed

Error: Unable to resolve @nrwl/node:execute. #9168

icastillejogomez opened this issue Mar 3, 2022 · 37 comments · Fixed by #9184
Assignees
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug

Comments

@icastillejogomez
Copy link

Current Behavior

I'm receiving this error after clean express template created:

❯ npx create-nx-workspace
npx: instaló 48 en 13.442s
✔ Workspace name (e.g., org name)     · bullflix-nx
✔ What to create in the new workspace · express
✔ Application name                    · api
✔ Use Nx Cloud? (It's free and doesn't require registration.) · No

 >  NX   Nx is creating your v13.8.4 workspace.

   To make sure the command works reliably in all environments, and that the preset is applied correctly,
   Nx will run "npm install" several times. Please wait.

✔ Installing dependencies with npm
✔ Nx has successfully created the workspace.
❯ cd bullflix-nx/
❯ nx run api:serve
Error: Unable to resolve @nrwl/node:execute.
Cannot find executor 'execute' in /Users/nacho/Code/bullflix-nx/node_modules/@nrwl/node/executors.json.
    at Workspaces.readExecutor (/Users/nacho/Code/bullflix-nx/node_modules/@nrwl/tao/src/shared/workspace.js:92:19)
    at getExecutorForTask (/Users/nacho/Code/bullflix-nx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:135:22)
    at getCustomHasher (/Users/nacho/Code/bullflix-nx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:140:25)
    at TasksSchedule.<anonymous> (/Users/nacho/Code/bullflix-nx/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
    at Generator.next (<anonymous>)
    at /Users/nacho/Code/bullflix-nx/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at __awaiter (/Users/nacho/Code/bullflix-nx/node_modules/tslib/tslib.js:113:16)
    at TasksSchedule.hashTask (/Users/nacho/Code/bullflix-nx/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:113:38)
    at TasksSchedule.<anonymous> (/Users/nacho/Code/bullflix-nx/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:58:24)
Unexpected error:
Error: Unable to load hasher for task "api:serve"
    at getCustomHasher (/Users/nacho/Code/bullflix-nx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:145:15)
    at TasksSchedule.<anonymous> (/Users/nacho/Code/bullflix-nx/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
    at Generator.next (<anonymous>)
    at /Users/nacho/Code/bullflix-nx/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at __awaiter (/Users/nacho/Code/bullflix-nx/node_modules/tslib/tslib.js:113:16)
    at TasksSchedule.hashTask (/Users/nacho/Code/bullflix-nx/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:113:38)
    at TasksSchedule.<anonymous> (/Users/nacho/Code/bullflix-nx/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:58:24)
    at Generator.next (<anonymous>)
    at /Users/nacho/Code/bullflix-nx/node_modules/tslib/tslib.js:117:75

Expected Behavior

Start the server

Steps to Reproduce

Run npx create-nx-workspace or npx create-nx-workspace@latest and the run nx serve api or nx run api:serve

Repo example(https://github.com/icastillejogomez/bullflix-nx)

This issue may not be prioritized if details are not provided to help us reproduce the issue.

Environment

MacOS with the latest os version.

❯ node -v
v16.13.1
❯ npm -v
6.14.15
❯ yarn -v
1.22.11
@dayanandgarg
Copy link

This is the issue with latest version, working fine in @nrwl packages versions 13.4.1

@tanyudii
Copy link

tanyudii commented Mar 3, 2022

Same problem with version 13.8.4.
Rollback to version 13.8.3 and working fine

@clementguillot
Copy link

The issue also affects existing repo and nx build ... command.

@AliYusuf95
Copy link
Contributor

This happened in the latest release 13.8.4.
@jaysoo I think migrations in #9086 prepared for 13.9.0 but it got released before that.

@AliYusuf95
Copy link
Contributor

@icastillejogomez To fix the issue just replace the following executers:

  • "executor": "@nrwl/node:execute" -> "executor": "@nrwl/node:node"
  • "executor": "@nrwl/node:build" -> "executor": "@nrwl/node:webpack"

@Jeffrey-Zutt
Copy link

We're experiencing the same problem after upgrading from 13.8.3 to 13.8.4.

@clementguillot
Copy link

@AliYusuf95 I confirm that the issue is fixed once executers are patched. Thanks!

@icastillejogomez
Copy link
Author

Great! Should generate a new versión without errors. Thank you so much mates!

@stephenwade
Copy link
Contributor

I think we should keep this ticket open until the issue is fixed in Nx.

@ChristianMatthias
Copy link

I encountered this issue too.
Replacing all occurrences of
"executor":"@nrwl/node:execute"
with
"executor": "@nrwl/node:node"
in the project.json file (just make a project-wide search for the string "node:execute" and you should find it).

@teklakct
Copy link

teklakct commented Mar 4, 2022

here #9086 you will find all the changes and motivation for making them

@vecernik
Copy link

vecernik commented Mar 4, 2022

shouldn't be this a part of a migration?

@tanyudii
Copy link

tanyudii commented Mar 4, 2022

@icastillejogomez To fix the issue just replace the following executers:

  • "executor": "@nrwl/node:execute" -> "executor": "@nrwl/node:node"
  • "executor": "@nrwl/node:build" -> "executor": "@nrwl/node:webpack"

and also replace @nrwl/node:package -> @nrwl/js:tsc

the problems in my libs, the reference is from: #9086

@icastillejogomez
Copy link
Author

I didn't tried with Nest lib. I'm using Next.js, express, react and some node in-house libs.

@beeman
Copy link
Contributor

beeman commented Mar 4, 2022

shouldn't be this a part of a migration?

It looks like the migration is there but won't be triggered until Nx 13.9.0.

Edit: Looks it will be there in 13.8.5

1390cd0

@bennycode
Copy link
Contributor

I upgraded from v13.8.3 to v13.8.5 which got me this error:

Error: Unable to resolve @nrwl/node:build

Will try to replace "executor": "@nrwl/node:build" with "executor": "@nrwl/node:webpack"...

@anandsathe67
Copy link

With 13.8.5 - still having trouble:
Error: Unable to resolve @nrwl/node:package. Cannot find executor 'package' in /Users/anand/GitHub/xxx/node_modules/@nrwl/node/executors.json. at Workspaces.readExecutor (/Users/anand/GitHub/xxx/node_modules/@nrwl/tao/src/shared/workspace.js:92:19) at getExecutorForTask (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:135:22) at getCustomHasher (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:140:25) at TasksSchedule.<anonymous> (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)

@ozyman42
Copy link

@icastillejogomez To fix the issue just replace the following executers:

  • "executor": "@nrwl/node:execute" -> "executor": "@nrwl/node:node"
  • "executor": "@nrwl/node:build" -> "executor": "@nrwl/node:webpack"

They need to stop making these breaking changes in non major upgrades

@anandsathe67
Copy link

anandsathe67 commented Mar 17, 2022

With 13.9.2 - still having trouble: Error: Unable to resolve @nrwl/node:package. Cannot find executor 'package' in /Users/anand/GitHub/xxx/node_modules/@nrwl/node/executors.json. at Workspaces.readExecutor (/Users/anand/GitHub/xxx/node_modules/@nrwl/tao/src/shared/workspace.js:92:19) at getExecutorForTask (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:135:22) at getCustomHasher (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:140:25) at TasksSchedule.<anonymous> (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
Issue still exists in 13.9.1 - this is pretty vexing. Was hoping i wouldnt have to patch nrwl but I guess fixing this doesn't seem to be a priority. Thanks @alexleung @tanyudii

@jberrydev
Copy link

Yea what should we change node:package to? node:webpack?

@jaypersanchez
Copy link

  • @nrwl/node

I

With 13.9.2 - still having trouble: Error: Unable to resolve @nrwl/node:package. Cannot find executor 'package' in /Users/anand/GitHub/xxx/node_modules/@nrwl/node/executors.json. at Workspaces.readExecutor (/Users/anand/GitHub/xxx/node_modules/@nrwl/tao/src/shared/workspace.js:92:19) at getExecutorForTask (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:135:22) at getCustomHasher (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:140:25) at TasksSchedule.<anonymous> (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
Issue still exists in 13.9.1 - this is pretty vexing. Was hoping i wouldnt have to patch nrwl but I guess fixing this doesn't seem to be a priority. Thanks @alexleung @tanyudii

With 13.9.2 - still having trouble: Error: Unable to resolve @nrwl/node:package. Cannot find executor 'package' in /Users/anand/GitHub/xxx/node_modules/@nrwl/node/executors.json. at Workspaces.readExecutor (/Users/anand/GitHub/xxx/node_modules/@nrwl/tao/src/shared/workspace.js:92:19) at getExecutorForTask (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:135:22) at getCustomHasher (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:140:25) at TasksSchedule.<anonymous> (/Users/anand/GitHub/xxx/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
Issue still exists in 13.9.1 - this is pretty vexing. Was hoping i wouldnt have to patch nrwl but I guess fixing this doesn't seem to be a priority. Thanks @alexleung @tanyudii

I have NX version 13.9.5 and I still get the error above. My DevDependencies in package.json for "@nrwl" is on 13.3.6. This is all on Windows 10. Everything is fine on my MacOS with NX version 13.3.6. So I am trying to downgrade the NX version on the Windows laptop from 13.9.5 to 13.3.6 but I'm not having any luck.

@jaypersanchez
Copy link

I have NX version 13.9.5 and I still get the error above. My DevDependencies in package.json for "@nrwl" is on 13.3.6. This is all on Windows 10. Everything is fine on my MacOS with NX version 13.3.6. So I am trying to downgrade the NX version on the Windows laptop from 13.9.5 to 13.3.6 but I'm not having any luck.

@jedihacks
Copy link

  • "executor": "@nrwl/node:node"

Maybe I'm missing something here - but I generated a brand new nx project and doing a find all for "executor": "@nrwl/node:node" doesn't yield any results. I tried adding it in both workspace.json and angular.json (just in case) but neither made a difference.

I originally generated the project with the latest nx for angular (13.9.6) and then I've been slowly downgrading to try to get back to where it works. I think perhaps similar issue to @jaypersanchez

TypeError: Cannot read property 'split' of undefined at getExecutorForTask (/Users/jedidiahweller/development/Startup-Wars-App/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:129:49) at getCustomHasher (/Users/jedidiahweller/development/Startup-Wars-App/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:135:25) at TaskOrchestrator.<anonymous> (/Users/jedidiahweller/development/Startup-Wars-App/node_modules/@nrwl/workspace/src/tasks-runner/task-orchestrator.js:304:62) at Generator.next (<anonymous>) at /Users/jedidiahweller/development/Startup-Wars-App/node_modules/tslib/tslib.js:117:75 at new Promise (<anonymous>) at __awaiter (/Users/jedidiahweller/development/Startup-Wars-App/node_modules/tslib/tslib.js:113:16) at TaskOrchestrator.hashTask (/Users/jedidiahweller/development/Startup-Wars-App/node_modules/@nrwl/workspace/src/tasks-runner/task-orchestrator.js:303:38) at /Users/jedidiahweller/development/Startup-Wars-App/node_modules/@nrwl/workspace/src/tasks-runner/task-orchestrator.js:216:56 at Array.map (<anonymous>) Unexpected error: Error: Unable to load hasher for task "services:build" at getCustomHasher (/Users/jedidiahweller/development/Startup-Wars-App/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:140:15) at TaskOrchestrator.<anonymous> (/Users/jedidiahweller/development/Startup-Wars-App/node_modules/@nrwl/workspace/src/tasks-runner/task-orchestrator.js:304:62) at Generator.next (<anonymous>) at /Users/jedidiahweller/development/Startup-Wars-App/node_modules/tslib/tslib.js:117:75 at new Promise (<anonymous>) at __awaiter (/Users/jedidiahweller/development/Startup-Wars-App/node_modules/tslib/tslib.js:113:16) at TaskOrchestrator.hashTask (/Users/jedidiahweller/development/Startup-Wars-App/node_modules/@nrwl/workspace/src/tasks-runner/task-orchestrator.js:303:38) at /Users/jedidiahweller/development/Startup-Wars-App/node_modules/@nrwl/workspace/src/tasks-runner/task-orchestrator.js:216:56 at Array.map (<anonymous>) at TaskOrchestrator.<anonymous> (/Users/jedidiahweller/development/Startup-Wars-App/node_modules/@nrwl/workspace/src/tasks-runner/task-orchestrator.js:216:37)

@kevinbeal
Copy link

When using v13.3.11, the opposite of the fix above is that solution (i.e. changing the executor option from @nrwl/node:node to @nrwl/node:execute and @nrwl/node:webpack to @nrwl/node:build).

@MartinMuzatko
Copy link

MartinMuzatko commented May 10, 2022

I'm on a fresh installation (nx 14.1.4, using the typescript preset) and follow instructions from here: https://nx.dev/getting-started/nx-and-typescript#create-a-typescript-based-application

With a fresh nx monorepo, I still get this error:

Unable to resolve @nrwl/node:app.
Cannot find module '@nrwl/node/package.json'
Require stack:
- /home/martin/dev/test/rpctest/node_modules/nx/src/utils/nx-plugin.js
- /home/martin/dev/test/rpctest/node_modules/nx/src/config/workspaces.js
- /home/martin/dev/test/rpctest/node_modules/nx/src/command-line/generate.js
- /home/martin/dev/test/rpctest/node_modules/nx/src/command-line/nx-commands.js
- /home/martin/dev/test/rpctest/node_modules/nx/bin/init-local.js
- /home/martin/dev/test/rpctest/node_modules/nx/bin/nx.js
- /usr/lib/node_modules/nx/bin/nx.js

@integrateddigital
Copy link

This breaks the tutorial https://nx.dev/getting-started/nx-and-typescript

@Signaturo
Copy link

Ran into this issue while running a nest api application. The following solutions helped me:

@icastillejogomez To fix the issue just replace the following executers:

  • "executor": "@nrwl/node:execute" -> "executor": "@nrwl/node:node"
  • "executor": "@nrwl/node:build" -> "executor": "@nrwl/node:webpack"

Configuration:

"@nrwl/cli": "13.4.6",
"@nrwl/nest": "14.1.7",
"@nrwl/workspace": "14.1.7"

@nhhockeyplayer
Copy link

this is still happening on fresh project generations

all executors are in order

meanstack02@admin meanstacknh % nx report                                        

 >  NX   Report complete - copy this into the issue template

   Node : 16.15.1
   OS   : darwin x64
   yarn : 1.22.18
   
   nx : 14.2.4
   @nrwl/angular : 14.2.4
   @nrwl/cypress : 14.2.4
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.2.4
   @nrwl/eslint-plugin-nx : 14.2.4
   @nrwl/express : Not Found
   @nrwl/jest : 14.2.4
   @nrwl/js : 14.2.4
   @nrwl/linter : 14.2.4
   @nrwl/nest : 14.2.4
   @nrwl/next : Not Found
   @nrwl/node : 14.2.4
   @nrwl/nx-cloud : 14.0.8
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.2.4
   @nrwl/web : Not Found
   @nrwl/workspace : 14.2.4
   typescript : 4.7.3
   ---------------------------------------
   Community plugins:
   	 @ngrx/component-store: 13.2.0
   	 @ngrx/effects: 13.2.0
   	 @ngrx/entity: 13.2.0
   	 @ngrx/router-store: 13.2.0
   	 @ngrx/store: 13.2.0
   	 @nxtend/ionic-angular: 13.1.0
   	 @ngrx/schematics: 13.2.0
   	 @ngrx/store-devtools: 13.2.0
   	 @nxpm/stack: 4.21.0

@esantelmo
Copy link

this is still happening on fresh project generations

all executors are in order

meanstack02@admin meanstacknh % nx report                                        

 >  NX   Report complete - copy this into the issue template

   Node : 16.15.1
   OS   : darwin x64
   yarn : 1.22.18
   
   nx : 14.2.4
   @nrwl/angular : 14.2.4
   @nrwl/cypress : 14.2.4
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.2.4
   @nrwl/eslint-plugin-nx : 14.2.4
   @nrwl/express : Not Found
   @nrwl/jest : 14.2.4
   @nrwl/js : 14.2.4
   @nrwl/linter : 14.2.4
   @nrwl/nest : 14.2.4
   @nrwl/next : Not Found
   @nrwl/node : 14.2.4
   @nrwl/nx-cloud : 14.0.8
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.2.4
   @nrwl/web : Not Found
   @nrwl/workspace : 14.2.4
   typescript : 4.7.3
   ---------------------------------------
   Community plugins:
   	 @ngrx/component-store: 13.2.0
   	 @ngrx/effects: 13.2.0
   	 @ngrx/entity: 13.2.0
   	 @ngrx/router-store: 13.2.0
   	 @ngrx/store: 13.2.0
   	 @nxtend/ionic-angular: 13.1.0
   	 @ngrx/schematics: 13.2.0
   	 @ngrx/store-devtools: 13.2.0
   	 @nxpm/stack: 4.21.0

Same here in June 16th 2022

@crowmagnumb
Copy link

Mine were in a different section...

        "serve": {
          "builder": "@nrwl/node:execute",
        },

But yes changing from node:execute to node:node fixed it.

@ldco2016
Copy link

ldco2016 commented Sep 8, 2022

@crowmagnumb

Not sure why this was closed because I upgraded to Nx 14.6.4 and Angular 14 and I am still getting the error when I run:

nx serve <project-name> --configuration=development --open --aot --watch

 NX   Report complete - copy this into the issue template

   Node : 16.16.0
   OS   : darwin x64
   yarn : 1.22.19

   nx : 14.6.4
   @nrwl/angular : 14.6.4
   @nrwl/cypress : 14.6.4
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.6.4
   @nrwl/eslint-plugin-nx : 14.6.4
   @nrwl/express : Not Found
   @nrwl/jest : 14.6.4
   @nrwl/js : 14.6.4
   @nrwl/linter : 14.6.4
   @nrwl/nest : 14.6.4
   @nrwl/next : Not Found
   @nrwl/node : 14.6.4
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.6.4
   @nrwl/web : 14.6.4
   @nrwl/workspace : 14.6.4
   typescript : 4.7.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:

@HopeKenga
Copy link

I am facing the same issue even after an upgrade .

 NX   Report complete - copy this into the issue template

   Node : 18.8.0
   OS   : darwin arm64
   npm  : 8.18.0
   
   nx : 14.7.13
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.7.13
   @nrwl/eslint-plugin-nx : Not Found
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.7.13
   @nrwl/js : 14.7.13
   @nrwl/linter : 14.7.13
   @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/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.7.13
   typescript : 4.8.3
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:

@crowmagnumb
Copy link

@ldco2016 Not sure why you replied that to me. I didn´t close the issue. :)

@akumbhani66
Copy link

I'm on a fresh installation (nx 14.1.4, using the typescript preset) and follow instructions from here: https://nx.dev/getting-started/nx-and-typescript#create-a-typescript-based-application

With a fresh nx monorepo, I still get this error:

Unable to resolve @nrwl/node:app.
Cannot find module '@nrwl/node/package.json'
Require stack:
- /home/martin/dev/test/rpctest/node_modules/nx/src/utils/nx-plugin.js
- /home/martin/dev/test/rpctest/node_modules/nx/src/config/workspaces.js
- /home/martin/dev/test/rpctest/node_modules/nx/src/command-line/generate.js
- /home/martin/dev/test/rpctest/node_modules/nx/src/command-line/nx-commands.js
- /home/martin/dev/test/rpctest/node_modules/nx/bin/init-local.js
- /home/martin/dev/test/rpctest/node_modules/nx/bin/nx.js
- /usr/lib/node_modules/nx/bin/nx.js

@MartinMuzatko , Not sure if this issue is still persist for you. I had same issue and able to resolve it by npm i @nrwl/node

@dotmantosh
Copy link

The issue also affects existing repo and nx build ... command.

has this issue been resolved please?

@integrateddigital
Copy link

integrateddigital commented Feb 5, 2023 via email

@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 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.