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

mbt: not found #1135

Closed
ThePlenkov opened this issue Sep 27, 2024 · 2 comments
Closed

mbt: not found #1135

ThePlenkov opened this issue Sep 27, 2024 · 2 comments

Comments

@ThePlenkov
Copy link

Hi!

In my projects I use workspaces.

So i have few nodejs apps. The problem starts at build:

cap-xsa: > [email protected] mbt
cap-xsa: > mbt build --platform xsa --mtar=${npm_package_name}.mtar
cap-xsa: [2024-09-27 17:09:35]  INFO Cloud MTA Build Tool version 1.2.31
cap-xsa: [2024-09-27 17:09:35]  INFO generating the "Makefile_20240927170935.mta" file...
cap-xsa: [2024-09-27 17:09:35]  INFO done
cap-xsa: [2024-09-27 17:09:35]  INFO executing the "make -f Makefile_20240927170935.mta p=xsa mtar=cap-xsa.mtar strict=true mode=" command...
cap-xsa: [2024-09-27 17:09:35]  INFO validating the MTA project
cap-xsa: [2024-09-27 17:09:35]  INFO running the "before-all" build...
cap-xsa: [2024-09-27 17:09:35]  INFO executing the "npm run build" command...
cap-xsa: > [email protected] build
cap-xsa: > cds build
cap-xsa: Detected /mnt/wsl/workspace/ubuntu/cap-xsa/tsconfig.json. If this is a TypeScript project, consider running commands using cds-ts instead of cds.
cap-xsa: building project [/mnt/wsl/workspace/ubuntu/cap-xsa], clean [true]
cap-xsa: cds-dk [8.2.3], cds [8.2.3], compiler [5.2.0], home [/mnt/wsl/workspace/ubuntu/cap-xsa/node_modules/@sap/cds]
cap-xsa: {
cap-xsa:   build: {
cap-xsa:     target: 'gen',
cap-xsa:     tasks: [
cap-xsa:       { for: 'nodejs', src: 'srv', options: { model: ['db', 'srv', 'app'] }}
cap-xsa:     ]
cap-xsa:   }
cap-xsa: }
cap-xsa: done > wrote output to:
cap-xsa:    gen/srv/package-lock.json
cap-xsa:    gen/srv/package.json
cap-xsa:    gen/srv/srv/csn.json
cap-xsa:    gen/srv/srv/odata/v4/CatalogService.xml
cap-xsa: build completed in 296 ms
cap-xsa: [2024-09-27 17:09:35]  INFO validating the MTA project
cap-xsa: [2024-09-27 17:09:35]  INFO building the "cap-xsa-srv" module...
cap-xsa: [2024-09-27 17:09:35]  INFO executing the "npm install --production" command...
cap-xsa: npm warn config production Use `--omit=dev` instead.
cap-xsa: .
cap-xsa: added 13 packages, and audited 15 packages in 1s
cap-xsa: 1 package is looking for funding
cap-xsa:   run `npm fund` for details
cap-xsa: found 0 vulnerabilities
cap-xsa: [2024-09-27 17:09:36]  INFO the build results of the "cap-xsa-srv" module will be packaged and saved in the "/mnt/wsl/workspace/ubuntu/cap-xsa/.cap-xsa_mta_build_tmp/cap-xsa-srv" folder
cap-xsa: [2024-09-27 17:09:36]  INFO finished building the "cap-xsa-srv" module
cap-xsa: [2024-09-27 17:09:36]  INFO building the "cap-xsa" module...
cap-xsa: [2024-09-27 17:09:36]  INFO executing the "npm install --production" command...
cap-xsa: npm warn config production Use `--omit=dev` instead.
cap-xsa: .
cap-xsa: up to date, audited 626 packages in 1s
cap-xsa: 67 packages are looking for funding
cap-xsa:   run `npm fund` for details
cap-xsa: found 0 vulnerabilities
cap-xsa: [2024-09-27 17:09:38]  INFO the build results of the "cap-xsa" module will be packaged and saved in the "/mnt/wsl/workspace/ubuntu/cap-xsa/.cap-xsa_mta_build_tmp/cap-xsa" folder
cap-xsa: [2024-09-27 17:09:38]  INFO finished building the "cap-xsa" module
cap-xsa: /bin/sh: 1: /mnt/wsl/workspace/ubuntu/cap-xsa/node_modules/mbt/unpacked_bin/mbt: not found
cap-xsa: Error: could not build the MTA project: could not execute the "make -f Makefile_20240927170935.mta p=xsa mtar=cap-xsa.mtar strict=true mode=" command: exit status 2
cap-xsa: [2024-09-27 17:09:38] ERROR could not build the MTA project: could not execute the "make -f Makefile_20240927170935.mta p=xsa mtar=cap-xsa.mtar strict=true mode=" command: exit status 2

So what just happens - is mbt being called - calls npm install --production for the module, but that module is a workspace - and it delets all non-production packages from node_modules and because of this mbt is not available anymore because is dev dependency.

So what I need is to force somehow mbt not to install dependencies anywhere. How to do this?

Thanks!

@yutaoj
Copy link
Collaborator

yutaoj commented Nov 26, 2024

I suggest you should remove the mbt from your devdependencies in package.json and install mbt global with command line "npm install -g mbt" .

@ThePlenkov
Copy link
Author

No actually I don't want to do this because this is how we build apps - we keep builder components in a dev dependencies so no surprises in CICD on version upgrades. But actually I found the reason- this not directly related to mbt but mainly to a builder config where before script is npm ci --production. The problem is - in combination with workspaces - it basically runs this command in a root folder and it removes all dev dependencies including mbt.

So the solution is to call npm ci but for the whole project ( or not call it at all ), that's it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants