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"
},
...
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742330047a4423534.html
评论列表(0条)