admin管理员组文章数量:1332339
I have an Nx workspace (v. 20.1) with a NestJS app. Locally, everything works fine, nx build, etc. But when running CI on Heroku, I get this error:
NX Could not find Nx modules in this workspace.
My package.json:
...
"scripts": {
"heroku-prebuild": "npm install && npm run build:prod",
"build:prod": "nx build my-node-app --configuration production",
...
}
...
I have an Nx workspace (v. 20.1) with a NestJS app. Locally, everything works fine, nx build, etc. But when running CI on Heroku, I get this error:
NX Could not find Nx modules in this workspace.
My package.json:
...
"scripts": {
"heroku-prebuild": "npm install && npm run build:prod",
"build:prod": "nx build my-node-app --configuration production",
...
}
...
Share
Improve this question
asked Nov 20, 2024 at 20:33
Sebastian DenisSebastian Denis
1,03112 silver badges21 bronze badges
1 Answer
Reset to default 0So, after many tries, I've found the issue which was not using "heroku-postbuild" script for nx build. It looks like prebuild doesn't wait for npm install, and nx is unavailable.
Here is the working package.json:
...
"scripts": {
"heroku-prebuild": "npm install",
"heroku-postbuild": "nx build my-node-app --configuration production",
"start": "node dist/apps/my-node-app/main.js",
"build:prod": "nx build my-node-app --configuration production"
},
...
本文标签:
版权声明:本文标题:node.js - Could not find Nx modules in this workspace while using Heroku deployment for NestJS app - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742330047a2454509.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论