What is the correct way to compile core?

Recently migrated an instance from 8.2.2 to 8.5.1. Here the behavior was identified that when saving a value from a dynamic dropdown type field, the value is not sent and is not persisted. I found this issue https://github.com/salesagility/SuiteCRM-Core/issues/381 where it is mentioned that making a modification in /core/app/core/src/lib/fields/base/base-enum.component. ts could solve the problem. I’m trying to test this but I understand I have to recompile core. Could you clarify for me if this is the case and what is the correct way to recompile the core?

Thanks in advance

I notice the entry "build-dev:core": "ng build core" in the scripts section of package.json

Would it be enough to execute this command?

Hey @mario.martinez,

The following guide should be able to help you: Front-end Developer Install Guide :: SuiteCRM Documentation

Make sure you have the correct node, yarn and ng cli versions: Compatibility Matrix :: SuiteCRM Documentation

Thanks for answering. I’m going to read

I’ve use all of these at some point, depending on what I am changing

yarn run build:core
yarn run build:shell
yarn run build:defaultExt

Change any of those build to build-dev if your environment is dev

@pgr In this particular case, I want to only modify core/app/core/src/lib/fields/base/base-enum.component.ts, should I just use yarn run build:core?

Is there any consideration in executing this command?

That’s it, go ahead.

If you want a backup, just copy the dist folder, that’s what the frontend compilation changes.

Hello,

When trying the command yarn run build:core I get

yarn run v1.22.22
$ng build core --configuration production
Building Angular Package
(node:1882611) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I have updated the versions according to the compatibility matrix https://docs.suitecrm.com/8.x/admin/compatibility-matrix/#_suitecrm_8_5_x

  • node v18.13.0
  • yarn 1.22.22

About Angular cli when I run ng v in the root directory of the project I get 12.1.0 but if I run outside of it I get 16.2.12 which is the one suggested in the documentation

What could be the cause of this error?

I don’t know. You can use that suggested --trace-deprecation to find the offending line of code and change the rmdir to rm.

I don’t understand why a deprecation warning would break a compilation - it’s not a FATAL…

About the ng versions, I also don’t know. Maybe it is affected by the tsconfig.json or the package.json in the directory? Anyway, you might need to review your PATH settings etc, but that will be specific to ng documentation. Try ng version to see all installed versions.

I managed to resolve the behavior by following the steps described in this documentation https://docs.suitecrm.com/8.x/developer/installation-guide/front-end-installation-guide/

yarn install
yarn run build:common
yarn run build:core
yarn run build:shell

Before yarn install I had to execute sudo chmod -R 777 node_modules/ because without this the message was displayed

error Error: EACCES: permission denied, unlink '/var/www/crm.local/node_modules/.yarn-integrity'

For the other commands to work, I had to be in the main directory of the project first execute sudo chmod -R 775 . To pass errors like

Could not resolve entry module "dist/common/esm2022/common.mjs".

What happens when trying yarn run build:common

The other commands are executed successfully and the dynamic dropdown problem is resolved.

Thanks for the assistance

1 Like