2

Building a Liferay theme fails with an error Cannot find module 'liferay-font-awesome'. What's wrong and how can I fix the issue?

$ mkdir liferay-workspace
$ cd liferay-workspace/
$ blade init --liferay-version portal-7.4-ga6
$ blade server init
$ cd themes/
$ yo liferay-theme # Would you like to add Font Awesome to your theme? Yes
$ cd my-liferay-theme/
$ gulp build
[18:55:39] Error: Cannot find module 'liferay-font-awesome'
$ npm i liferay-font-awesome
$ gulp build
[18:58:33] Error: Cannot find module 'liferay-font-awesome'

Version information

$ npm -v 
6.14.12
$ blade version
blade version 4.0.10.202111191310
$ gulp -v     
CLI version: 2.3.0
Local version: 4.0.2
$ yo --version
4.3.0
$ java -version
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.13+8-post-Debian-1deb11u1, mixed mode, sharing)
haba713
  • 2,465
  • 1
  • 24
  • 45

1 Answers1

7

I did not use blade but got the same error with first creating a theme skeleton with yo liferay-theme and then running gulp build.

The error seems to relate to liferay-font-awesome version 3.5.0 which is the version Liferay theme generator puts into package.json.

I then changed the liferay-font-awesome version to 3.4.2 in package.json, executed npm install to update node_modules and after this gulp build completed successfully.

I did not test the theme in practise, just got it compiled.

  • Interestingly the latest version in npmjs.com is 3.5.0 but it still cannot compile with that version. Great that you provided a workaround for the issue. – Manuel Manhart Feb 11 '22 at 00:03