Questions about running Yarn

I am trying to understand some of the details of the developer setup.

When you run yarn, do you run it out of the root “/suitecrm/” folder, the “suitecrm/public/” folder, or the “/suitecrm/public/legacy/” folder? I am assuming the root folder “/suitecrm/” since that is where I see the package.json however I want to ask to make sure.

When yarn creates the “dist” folder is this new folder supposed to replace /suitecrm/public/dist folder or does it continue to reside in the “/suitecrm/dist/” folder?

Thank you.

You should run yarn from the root directory of the SuiteCRM project, which is typically the /suitecrm/ folder. This is where the package.json file is located. Running yarn in this directory ensures that the dependencies specified in package.json are installed correctly.

1 Like

Ok great that is what I thought but I wanted to make sure.
Do you know if the dist folder it generates is supposed to stay in the root folder or is it supposed to replace the one in the public folder?

Thank you!

The dist folder created by yarn will be generated in the root directory /suitecrm/, not in the public directory. Specifically:

  • /suitecrm/dist/: This is where the output of the build process will reside, containing the bundled and minified files ready for deployment.

It does not replace or directly interact with the /suitecrm/public/dist/ folder. Instead, the contents of /suitecrm/dist/ are typically intended to be used for deployment, while /suitecrm/public/dist/ might be used for other purposes, such as static assets during development or serving specific needs of the public-facing interface.

1 Like

Hey @JosephN,

Just to add to what @rsp said, and reply to your second question.

  1. The /suitecrm/dist/ is not the same as /suitecrm/public/dist

    • /suitecrm/dist/ contains the output of running:
      • yarn build:common
      • yarn build:core
    • /suitecrm/public/dist contains the output of running:
      • yarn build:shell
  2. The output paths the above are defined in angular.json

  3. You only need /suitecrm/dist/ for building /suitecrm/public/dist

  4. Depending on what you are doing please consider using the dev package, it already includes the dist folder

Some other posts that might help:

1 Like

Excellent thank you very much.

I am currently troubleshooting the yarn build failing on core with the “Maximum call stack size exceeded” and these were just questions that came up that I couldn’t find any direct answers for.

Thank you.

Thank you for the extra information, I appreciate it.

1 Like

Hey @JosephN,

If I remember correctly, that usually happens when you have a circular loop in dependencies.

E.g.: if you have an import <something> from 'core' within the core package.

To fix it you would need to change the import to import <something> from '.../.../<etc>'

The same applies to common, shell or an extension

2 Likes

That is very helpful.
However, I haven’t created any custom code yet. Outside of a 3rd party SMS module we just installed to try out it is pretty much a standard install of v8.3.0. It was its instructions to install the front-end developer options, node, yarn, and angular/cli, as part of its setup that had me run into this problem in the first place, making me think it may be an issue with their code. I will be removing their module and trying the process again. Then if that doesn’t work I will be planning an upgrade to the current head version of suitecrm. However, I will be setting up a separate install on a local VM for development so that I can begin to do development.

Thank you for your time and your response.

That’s a good plan :bulb:. Let us know how it went for you. :+1: :white_check_mark:

@JosephN do they require you to run any of the yarn build commands?

In theory that should not be needed for production. On prod envs you should not need npm, yarn, or any of the front end dependencies.

The only thing you should need is the “built” front end code, the one on /suitecrm/public/dist (which already comes with the install package).

The Compatiblity Matrix states that yarn, ng, etc are only required for development. see:

1 Like

That is what I thought and this site’s APP_ENV is set to “prod” but their instructions were pretty specific.

@JosephN true, they explicitly tell you to install yarn and rebuild the angular files. So I guess there is no way around it.

(Though I think the idea behind the way extensions are setup with angular federation and all that, is to avoid the need to have to build the extension)

I agree, it is the only module I have tested that has had this instruction…

Thank you for your response.

1 Like