Tech Blog

Installing AEK 2 in 2021

AEK 2 was first released in 2016, designed for Node v8 (and React v13). Over the years we’ve updated it (to target Node v10, and React v15, and later React v16). With these changes came changes to the underlying technologies (swapping out npm for Yarn, for example). These third-party packages aren’t something we can maintain ourselves, and over the years we’ve noticed specific issues on a range of machines when installing AEK 2 for the first time.

This blog post aims to provide an up-to-date overview of how to manage your versions of Node.js and install and use AEK 2 with them.

Node versions and the AEK

The AEK is still intended to be used with Node 10 (any release, though generally the latest is the best). Past releases of Node.js can be found here on their site. For reference, the latest versions of 10 and 12 (currently) are listed below.

We list Node 12 here because there is a known issue with aek install on Node 10 (any version of Node 10). We currently don’t have a fix implemented for this issue, but to get around it you can run aek install on the package in question under Node 12. All other commands work with Node 10, and may have issues on Node 12.

Normally you can’t have more than one version of Node.js installed at a time. There is a utility on Windows we recommend for this called nvm-for-windows, or Node Version Manager for Windows (for Mac and other operating systems, there is nvm). Please follow the instructions in the README.md to set it up. It requires you to completely uninstall your existing Node.js version (if you have any installed).

Once you have nvm-for-windows installed, you can keep on adding different Node versions and switching between them as required. Each Node version is completely independent of any others, and any packages installed to one will not be shared with others. You will need to install the AEK CLI separate for each version of Node.js you install.

Installing the AEK

Before you try to install the AEK CLI, please do the following:

  1. Use NPM config to link the @ombiel name-spaced packages: npm config set @ombiel:registry https://npm.campusm.net/.
  2. Install Yarn: npm install -g yarn.
  3. Check you have gulp-cli installed. You can test this in a terminal program with gulp -v.
  4. If gulp isn’t recognised as a program, or your CLI version is “Unknown”, install it with yarn global add gulp-cli.
  5. You can then use Yarn to install the CLI: yarn global add https://npm.campusm.net/get/aek-cli.

This should be enough in most cases to get the AEK up and running.

Reminder – you will need to repeat this process for each version of Node that you have installed. So if you have both Node 10.24.1 and Node 12.22.5 installed, you will need to link the config, install Yarn, and then the AEK CLI twice.

Windows users

Windows users, you might still have a problem in running the aek command from the command line. It will tell you that “aek is not recognised as an internal or external command”. This is due to an issue with installing yarn modules globally. If you encounter this, follow the steps below:

  1. Check if your yarn prefix is set with yarn config get prefix, in a terminal program of your choice.
  2. If it isn’t set, set it to the parent directory of the following command: yarn global bin.
    1. It’ll look something like C:Users<USER>AppDataLocalYarn (by default).
  3. Use yarn config set prefix FILEPATH to do this (where FILEPATH is the directory we found on the line above).
  4. Add the actual bin to your system PATH with set PATH=%PATH%;FILEPATH.
    1. You can also do this via “Edit the system environment variables”, which can be found under System in Control Panel, or by searching for “environment variables” in the Start Menu.
  5. Restart your terminal program (be it cmd, PowerShell, or something different) and try aek again.
  6. If it still doesn’t work, add the parent directory from step 2 to your system PATH as well (again, this can be done using the Control Panel instead of a terminal).

Additional reading

Leave a Reply