avatar

Error: Unable to resolve @nrwl/node:execute

March 7, 2022, 12:06 p.m.

Hoy actualicé un proyecto que usa Nx 13.8.3 hacia 13.8.4. Al ejecutar el API con nx serve api obtuve el siguiente error:

Error: Unable to resolve @nrwl/node:execute.
Cannot find executor 'execute' in /home/diavolo/Projects/full-stack-nestjs-angular/node_modules/@nrwl/node/executors.json.
    at Workspaces.readExecutor (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/@nrwl/tao/src/shared/workspace.js:92:19)
        at getExecutorForTask (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:135:22)
    at getCustomHasher (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:140:25)
        at TasksSchedule.<anonymous> (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
    at Generator.next (<anonymous>)
        at /home/diavolo/Projects/full-stack-nestjs-angular/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
        at __awaiter (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/tslib/tslib.js:113:16)
    at TasksSchedule.hashTask (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:113:38)
        at TasksSchedule.<anonymous> (/home/diavolo/Projects/full-stack-nestjs-angular/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 (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:145:15)
        at TasksSchedule.<anonymous> (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
    at Generator.next (<anonymous>)
        at /home/diavolo/Projects/full-stack-nestjs-angular/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
        at __awaiter (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/tslib/tslib.js:113:16)
    at TasksSchedule.hashTask (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:113:38)
        at TasksSchedule.<anonymous> (/home/diavolo/Projects/full-stack-nestjs-angular/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:58:24)
    at Generator.next (<anonymous>)
        at /home/diavolo/Projects/full-stack-nestjs-angular/node_modules/tslib/tslib.js:117:75

Parece que ciertos cambios que hicieron no se llegan a reflejar en algunos archivos de configuración luego de realizar la migración.

La solución, hasta que tengamos una nueva versión que actualice esto manera automática con una migración, es actualizar el archivo project.json y reemplazar lo siguiente:

  • "executor": "@nrwl/node:execute" por "executor": "@nrwl/node:node"
  • "executor": "@nrwl/node:build" por "executor": "@nrwl/node:webpack"

Referencias