NX NestJs - 意外错误:错误:无法加载任务“api:serve”的哈希器
我一直在尝试遵循 这些指南学习NX,但是当我尝试提供nestJs api时遇到这个问题 您可以在此存储库上看到完整的代码
nx serve api
我收到这些错误
Error: Unable to resolve @nrwl/node:execute.
Cannot find executor 'execute' in /Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/node/executors.json.
at Workspaces.readExecutor (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/tao/src/shared/workspace.js:92:19)
at getExecutorForTask (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:135:22)
at getCustomHasher (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:140:25)
at TasksSchedule.<anonymous> (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
at Generator.next (<anonymous>)
at /Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
at __awaiter (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/tslib/tslib.js:113:16)
at TasksSchedule.hashTask (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:113:38)
at TasksSchedule.<anonymous> (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/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/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:145:15)
at TasksSchedule.<anonymous> (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
at Generator.next (<anonymous>)
at /Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
at __awaiter (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/tslib/tslib.js:113:16)
at TasksSchedule.hashTask (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:113:38)
at TasksSchedule.<anonymous> (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:58:24)
at Generator.next (<anonymous>)
at /Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/tslib/tslib.js:117:75
我按照指南字面意思1 1、名字一样,一切都一样。 所以我想问题出在我的本地机器(?)上,我运行带有 M1 芯片的 macOS 12.2.1。或者也许这些指南使用了一些旧版本的nx(?)并且同时发生了一些变化?
因此,如果有人能给我一些线索,我将非常感激。谢谢
编辑:
我尝试按照他们网站上的 官方 Nest with NX 演示进行操作。 当我尝试 nxserve api
时仍然遇到相同的错误
i have been trying to follow these guide to learn NX, but i encounter this problem when i tried to serve the nestJs api
you can see the complete code on this repo
nx serve api
i get these error
Error: Unable to resolve @nrwl/node:execute.
Cannot find executor 'execute' in /Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/node/executors.json.
at Workspaces.readExecutor (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/tao/src/shared/workspace.js:92:19)
at getExecutorForTask (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:135:22)
at getCustomHasher (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:140:25)
at TasksSchedule.<anonymous> (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
at Generator.next (<anonymous>)
at /Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
at __awaiter (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/tslib/tslib.js:113:16)
at TasksSchedule.hashTask (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:113:38)
at TasksSchedule.<anonymous> (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/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/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/utils.js:145:15)
at TasksSchedule.<anonymous> (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:114:62)
at Generator.next (<anonymous>)
at /Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
at __awaiter (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/tslib/tslib.js:113:16)
at TasksSchedule.hashTask (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:113:38)
at TasksSchedule.<anonymous> (/Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/@nrwl/workspace/src/tasks-runner/tasks-schedule.js:58:24)
at Generator.next (<anonymous>)
at /Users/dariantvirgiesiswadie/Documents/pribadi/shirt-shop/node_modules/tslib/tslib.js:117:75
i follow the guide literally 1 to 1, same name and everything.
so i suppose the problem is with my local machine (?) i running macOS 12.2.1 with M1 chip. or maybe these guide using some old version of nx (?) and something changed on the mean time?
so if anyone can give me a clue on this, would be very appreciated. thanks
edit :
i've try to follow the official Nest with NX demo from their website.
and still got the same error when i try to nx serve api
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,经过一番挖掘,它看起来像是最新(2022 年 3 月 4 日)nx 版本上的某种错误。
请参阅 nrwl 官方仓库上的此 github 问题。
根据那里的评论,要解决这个问题,只需替换以下执行器:
这也解决了我的问题。
Ok, after some digging, it looks like some kind of a bug on the latest (4 March 2022) nx build.
see this github issue on nrwl official repo.
According to the comments there, To fix the issue just replace the following executers:
And that solve my problem too.