Building a Liferay theme fails with an error "Cannot find module 'liferay-font-awesome'" - gulp

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)

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.

Related

How can I solve Angular CLI ng new error?

I'm trying to install new Angular project using angular/cli commmand:
ng new app-name
My tools are:
ng --version
Angular CLI: 8.2.2
Node: 10.16.3
OS: win32 x64
Angular:
...
Package Version
------------------------------------------------------
#angular-devkit/architect 0.802.2
#angular-devkit/core 8.2.2
#angular-devkit/schematics 8.2.2
#schematics/angular 8.2.2
#schematics/update 0.802.2
rxjs 6.4.0
So, in order to get the default angular app I run:
ng new app-name
Choose adding routing and CSS fro the styles.
I get the following output:
npm ERR! Unexpected end of JSON input while parsing near '...pes/gulp":"3.X","#typ'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\gusenica\AppData\Roaming\npm-cache\_logs\2019-08-20T15_56_11_846Z-debug.log
Package install failed, see above.
Question is how can I solve this problem?
It was some kind of npm-related problem. I just ran
npm cache clean --force
and it worked!

Openmpi on Fedora 21

I am trying to compile some code in Fedora 21 using 'mpif90'.
First I install openmpi with 'yum':
[root#localhost Inversion]# yum install openmpi
Loaded plugins: langpacks
Package openmpi-1.8.3-2.fc21.x86_64 already installed and latest version
Nothing to do
But then when I compile using 'make' it doesn't work:
[root#localhost Inversion]# make all
mpif90 -O3 -c src/dispersion.f90
make: mpif90: Command not found
Makefile:18: recipe for target 'obj' failed
make: *** [obj] Error 127
As you can see I've downloaded openmpi package but it wont compile.
You cannot compile because you haven't loaded the necessary module.
You need to load the environmental module, this is how Fedora is handling openmpi when you install it using:
dnf install openmpi
(in Fedora 25)
Just follow the following steps:
In your terminal, do:
module avail
You should see an output something like this:
--------------------- /usr/share/Modules/modulefiles ----------------------
dot module-git module-info modules null use.own
---------------------------- /etc/modulefiles -----------------------------
mpi/openmpi-x86_64
Notice there is the mpi/openmpi-x86_64 module available for you to 'load'.
In your terminal, you just do:
module load mpi/openmpi-x86_64
Now you have access to all the mpi compilers like mpif90 and mpic++ etc. You can see that the compiler binaries are stored in: /usr/lib64/openmpi/bin:
$ which mpif90
and you see the output is:
/usr/lib64/openmpi/bin/mpif90
dnf whatprovides "*/mpif90"
tells you what package provides this binary. In Fedora, you can get it from openmpi-devel or mpich packages. So running
yum install openmpi-devel
should do the job for you.

Error with gulp serve: Requiring external module babel-register

Running yeoman generator "Webapp", I'm getting an error when running gulp serve. Here are the following versions for a better background :
sw_vers && node -e 'console.log(process.platform, process.versions)'
ProductName: Mac OS X
ProductVersion: 10.11.3
BuildVersion: 15D21
darwin { http_parser: '2.6.0',
node: '5.2.0',
v8: '4.6.85.31',
uv: '1.7.5',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '56.1',
modules: '47',
openssl: '1.0.2e' }
node -v
v5.2.0
gulp -v
Requiring external module babel-register
CLI version 3.9.1
Local version 3.9.1
Finally the gulp serve error:
gulp serve
Requiring external module babel-register
\node_modules/babel-core/lib/transformation/file/options/option-manager.js:372
throw new Error("Couldn't find preset " + JSON.stringify(val) + " relative to directory " + JSON.stringify(dirname));
Does anybody have any idea what the problem could be, any suggestions?
Here's what I've tried:
npm uninstall gulp
npm install gulp
//with global flag and not
npm install --save-dev gulp
//installing babel-register manually w/wo global flag and --save-dev
npm install babel-register
npm cache clean
Also read through several of other posts with similar problem with no success, some of the following :
gulp serve: Failed to load external module babel-core/register
Requiring external module babel/register #726
babel was renamed to babel-core #727
Angular-Fullstack Requiring external module babel-register
yep, after running npm install --global gulp-cli I run gulp -v and I’ve got
Failed to load external module babel-register
Requiring external module babel-core/register
CLI version 1.2.1
Local version 3.9.1
then I updated CLI version to 3.9.1 (same as I have locally) but it did not help.
but when I downgrade CLI version to 3.9.0 it started work correct and message “Failed to load external module babel-register” not shown anymore.
Looks like 3.9.1 is buggy.
Run:
npm install -g gulp#3.9.0
hopefully it'll help you.
maybe this can help.
create .babelrc in your projects, and put this:
{
"presets": [
"es2015"
]
}
I have tried many ways explaining above, including
npm install --global gulp
npm install --save-dev gulp
etc for installation of gulp, but finally found solution by running below command, which change gulp to something gulp-cli on phpStorm command line.
npm install -D babel
npm install babel-cli babel-preset-es2015
me helped when i deleted and again installed both same version as global as local in the project directory the gulp and deleted and reinstal the babel-register.
sudo npm uninstall -g gulp
npm uninstall gulp
sudo npm install -g gulp#3.9.0
npm install gulp#3.9.0
npm uninstall babel-register
npm install babel-register

Error: Requiring external module babel-register

sw_vers && node -e 'console.log(process.platform, process.versions)'
ProductName: Mac OS X
ProductVersion: 10.11.3
BuildVersion: 15D21
darwin { http_parser: '2.6.0',
node: '5.2.0',
v8: '4.6.85.31',
uv: '1.7.5',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '56.1',
modules: '47',
openssl: '1.0.2e' }
node -v
v5.2.0
gulp -v
Requiring external module babel-register
CLI version 3.9.1
Local version 3.9.1
Getting error when running gulp serve, I've fixed this before by removing the entire webapp repo from local. Any and all help/advice appreciated, also please forgive if I've not formatted this issue as correctly as possible(first issue ever opened). Would like to resolve this without having to do this. gulp serve throws the following:
Running yeoman generator "Webapp", I'm getting an error when running gulp serve. Here are the following versions for a better background :
sw_vers && node -e 'console.log(process.platform, process.versions)'
ProductName: Mac OS X
ProductVersion: 10.11.3
BuildVersion: 15D21
darwin { http_parser: '2.6.0',
node: '5.2.0',
v8: '4.6.85.31',
uv: '1.7.5',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '56.1',
modules: '47',
openssl: '1.0.2e' }
node -v
v5.2.0
gulp -v
Requiring external module babel-register
CLI version 3.9.1
Local version 3.9.1
Finally the gulp serve error:
gulp serve
Requiring external module babel-register
\node_modules/babel-core/lib/transformation/file/options/option-manager.js:372
throw new Error("Couldn't find preset " + JSON.stringify(val) + " relative to directory " + JSON.stringify(dirname));
Does anybody have any idea what the problem could be, any suggestions?
Here's what I've tried:
npm uninstall gulp
npm install gulp
//with global flag and not
npm install --save-dev gulp
//installing babel-register manually w/wo global flag and --save-dev
npm install babel-register
npm cache clean
I had a very similar issue with running a custom project that was originally created using the Yeoman Webapp generator and found a solution that worked for me. A bit of context... the project was running fine on my Windows 7 machine and when I tried to move it over to my Mac OSX machine I received the exact same error. What I found works is creating a new Yeoman Web App project and drag & dropping the exact node-modules folder structure over to your existing project. Most likely than not, there is a dev dependency that your machine is not reading and fetching accurately, in this case, the babel-register module which is contained within this node-modules folder.
If possible for you to do, it's also worth comparing the versions of node, npm, gulp, gulp cli with your previous working version and the version you are having trouble loading when running gulp serve to see if they match.

what does gulp-"cli" stands for?

Can someone please explain what exactly are the differences between the following two methods of gulp installation:
$ npm install --global gulp-cli
and
$ sudo npm install -g gulp
It looks to me that both do the same thing except that the first method gives me a version 1.2.1, and the later gives me version 3.9.1
Can someone put into simple terms what exactly are the differences? and plus what is "cli" stands for?
The goal of gulp-cli is to let you use gulp like a global program, but without installing gulp globally.
For example if you installed gulp 3.9.1 globally and your project testGulp4 has gulp 4.0 installed locally, what would happen if you run gulp -v into testGulp4?
Without gulp-cli globally installed :
CLI version 3.9.1
In this case the version displayed is the global version of gulp. The local version 4.0 is totally ignored.
With gulp-cli globally installed :
CLI version 1.2.1
Local version 4.0.0-alpha.2
In this case the version displayed is the global version of gulp-cli and the local version of gulp. The global gulp 3.9.1 is totally ignored.
Conclusion :
gulp-cli: is preferred because it allows you to use different versions of gulp.
gulp: needs a local version of gulp installed.
CLI stands for Command Line Interface.
gulp is a JavaScript library. It lets you use gulp from JavaScript code.
gulp-cli is a utility program that lets you access gulp from your shell.