Problems with React4xp deploy

Enonic version: 7.7.1
OS: Ubuntu 20.04


I am relatively new to Enonic, I’m studying now the Enonic Headless CMS using React. But I’m having some problems with the react4xp application deployment.

In this guide “Setting up your project”, I create a project using the “starter-react4xp” but when I execute the command “Enonic project deploy” to run the project the error above happens. Can you please help me with this?

Thank you in advance

1 Like

Hi, Mateus!

The error message suggests to me that you don’t have the Node Package Manager npm installed properly, something that is required for a Node.js project like React. Are you able to run the command on its own? What happens if you try to run npm version ?

Best wishes,
Bjørnar Hjelmevold

Hi, Bjørnar

Thank you for the answer. The npm is installed normally.

@mateusfelicio I am also facing this issue… Please update this post if you find any solution.

The command enonic sandbox deploy runs a gradle build on your project which uses the gradle file build.gradle which in turn can’t find react4xp.gradle (normal, if this is your first deploy) and therefore tries to do npm install in order to install the necessary files, but this command fails for some reason.

Are you able to run npm install from within your project directory? (Looks like it’s /home/mateus/projects/myproject). What happens then? Does it fail with the same error message, or does it install the required files?

I had alredy tried run the npm install before the enonic project deploy but the weird is that Gradle still can’t find react4xp.gradle even it being there at “node_modules/react4xp/react4xp.gradle”, then the deploy tries again to run the npm install, causing the same problem of the first image of this post.

Other people of my job faced this problem but they did not have success or did not invest time to fix it;

To debug why the npm command does not work just use the enonic cli shell enonic project shell
The shell that you enter then is the enviroment where the build commands are run so you can see why or if it can find the npm install in the shell environment

Thank you very much, guys, I made it.

The problem was that my Enonic installation was using “Snapcraft” and that installation sends the enonic binary to /snap/bin/enonic and even having this folder in PATH variable the Enonic was not able to run the Enonic Shell corretly.

What I did to fix was remove all Enonic installed by “Snapcraft”, using the command sudo snap remove enonic, delete the folder “.enonic” in the user folder and install Enonic by “wget” as you can see in this link here “Installing Enonic CLI

After the installation the enonic binary was installed in “/usr/bin/enonic” and the Enonic was able to run correctly the shell and the deploy.


Great that you found a solution - maybew you could share which Linux distro you are using so we can investigate the problem further?

@mateusfelicio Thank you for ur solution and now it is work

@cherysan19 I’m happy that this helped you too.
@tsi My distro is the Ubuntu 20.04