Having the CF server path I can successfully insta...
# box-products
m
Having the CF server path I can successfully install CF2021 packages hard coding the .commandbox server name in the path ( i.e. cfpm.bat install sqlserver ). Q: how can I get the the server name dynamically? (or is there a better way to install CF2021 packages with commandbox?)
b
@Marco Al of that is unecessary. Just use the
cfpm
passthrough command built into CommandBox!
Copy code
CommandBox> cfpm install debugger
When run from the root of the server, CommandBox will find the actual
cfpm
shell script or batch file for you, ensure the Java_home is actually set and pass through your args to the actual command
I added a quick page to the docs about this, somehow it was missing. https://commandbox.ortusbooks.com/embedded-server/configuring-your-server/adobe-cfpm
m
Thanks Brad that works. I have another related question, I am running a script that starts the CF server and then runs the cfpm install command in a box recipe. Problem is that I always get "The xxx package is missing" error before the scripts finish running, at the end all is good but I want to skip the interim error. Any ideas? Maybe there is -force param to skip that check?
b
I'm not really clear on what you're describing
Where exactly is this error coming from? From Adobe's cfpm shell script or from CommandBox?
m
Its a CF error see the attached image
b
That has nothing to do with the execution of cfpm however
That just means the package isn't installed
So I'm not clear what the issue is
Also, I usually just put my cfpm call in a server script that runs automatically when the server starts, so there's no need for a recipe or anything
Copy code
{
  "scripts": {
    "onServerInstall": "cfpm install orm,pdf"
  }
}
Just integrate that into your
server.json
and it happens as the server starts up
Now if it's not running or something, then you'd need to provide the actual console output to debug
But doing it in the package script actually installs the modules prior to CF starting the first time
👍 1
m
Thanks Brad, I think this is very helpful
r
I was going to mention this earlier, but Brad beat me to it
We started adding this to our box.json so devs can just
box server start
without worrying about any packages that need to be installed