RE: Installing and Updating Blade CLI document doesn't actually install Blade

Olaf Kock, modified 1 Year ago. New Member Posts: 2 Join Date: 5/30/24 Recent Posts

The documents: https://learn.liferay.com/w/dxp/liferay-development/tooling/blade-cli/installing-and-updating-blade-cli and https://learn.liferay.com/w/dxp/liferay-development/tooling/blade-cli/troubleshooting-blade-cli#the-blade-command-is-not-available-in-my-cli
claims to describe installing Blade CLI using  a curl | sh command. But, doing so doesn't actually successfully install Blade CLI in a working state.

Context:
I'm trying to create a Liferay workspace to generate a sample project, but since the documentation describing how to get a Liferay workspace is poor to the point of being unusable, I'm attempting to install Blade and use it to generate a Liferay workspace. But, even that doesn't seem to work.

My use case:

  1. Run a Docker container with docker run -it --name liferay-workspace eclipse-temurin:8u352-b08-jdk
  2. Run the curl -L ... | sh command from the documentation
    1. The message says blade (small b) installed successfully, but attempting to run Blade commands shows "command not found"
  3. Run the echo >> bash command from the documentation
    1. attempting to run Blade commands still shows "command not found"
  4. Restart the container
    1. attempting to run blade commands still shows "command not found"
thumbnail
Russell Bohl, modified 1 Year ago. Expert Posts: 308 Join Date: 2/13/13 Recent Posts

Hi Kevin, I've followed these steps recently in my own system, and they worked. I have openjdk installed locally though. So it might be some issue unique to your setup. Why not just install the JDK on your developer machine?

thumbnail
Olaf Kock, modified 1 Year ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

Re the troubleshooting information in the documentation that you link: This adds the executable to the shell's path, but only for the next shell to be started​​​​​​​ that reads this file. Otherwise you can run "source .bash_profile" (if I'm not mistaken).

Or execute blade with an explicit path, for the time being.

Also, I don't expect that change to survive a docker container restart. After all, the container is meant to be immutable.

 

thumbnail
Drew Brokke, modified 1 Year ago. New Member Posts: 13 Join Date: 1/9/14 Recent Posts

Hi Kevin, thanks for bringing this to our attention. It looks like the image you are using does not source the .bash_profile by default, so the changes to the PATH according to the troubleshooting page won't have any effect unless you explicitly call "source ~/.bash_profile". An alternative could be to modify the command from that page to target the .bashrc file, which does appear to be sourced by the shell automatically. So the command would look like this:

echo 'export PATH="$PATH:$HOME/jpm/bin"' >> ~/.bashrc

In my local testing, I tried that command and re-started the container, and blade was found.

Would you be willing to try that and see if it works?