# NPM is confusing my Mautic 5 installation process

**URL:** <https://forum.mautic.org/t/npm-is-confusing-my-mautic-5-installation-process/33080>\
**Category:** Mautic 5 Install/Upgrade Support\
**Tags:** community\
**Created:** [August 10, 2024, 6:35pm UTC](https://forum.mautic.org/t/npm-is-confusing-my-mautic-5-installation-process/33080 "2024-08-10T18:35:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bilbobaggage](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bilbobaggage/32/11406_2.png) [@bilbobaggage](https://forum.mautic.org/u/bilbobaggage)\
**Post date:** [August 10, 2024, 6:35pm UTC](https://forum.mautic.org/t/npm-is-confusing-my-mautic-5-installation-process/33080/1 "2024-08-10T18:35:30Z")

</div>

**Your software**  
My Mautic version is: 5.1.0  
My PHP version is: 8.1  
My Database type and version is: MariaDB

**Your problem**  
My problem is: I’m trying to install Mautic 5 via composer using [this guide](https://joeykeller.com/mautic-5-composer-install-simplified/), I do not follow all the commands because some are outdated but I basically have the same flow. Everything goes smoothly until I get to the part where I have to install Nodejs and NPM, I install both using the steps from the official website with the following commands:

```auto
# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

# download and install Node.js (you may need to restart the terminal)
nvm install 18

# verifies the right Node.js version is in the environment
node -v # should print `v18.20.4`

# verifies the right npm version is in the environment
npm -v # should print `10.7.0`

```

That installs nicely nicely, I then proceed to install composer and finally mautic:

```auto
cd /var/www/html
sudo COMPOSER_ALLOW_SUPERUSER=1 composer create-project mautic/recommended-project:^5.0 mautic --no-interaction

```

And that’s where I get the following error at the end of the installation script process:

```auto
> npm ci --prefer-offline --no-audit
sh: 1: npm: not found
Script npm ci --prefer-offline --no-audit handling the npm-ci event returned with error code 127
Script @npm-ci was called via post-update-cmd

```

So I went ahead and installed NPM with ‘apt install npm’ command, hoping that fixes the problem. But no dice, apart from that error code above, I now get the following error as well, as if installing npm from the default repo downgrades my nodejs:

```auto
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'postcss-normalize-display-values@6.0.2',
npm WARN EBADENGINE required: { node: '^14 || ^16 || >=18.0' },
npm WARN EBADENGINE current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }

```

These errors are showing in the log: Showed in the above process.  
Like why does it say I have an unsupported engine when node -v and npm -v checks out and different than what that error report says?

Steps I have tried to fix the problem: Showed in the above process as well.

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [August 11, 2024, 7:28pm UTC](https://forum.mautic.org/t/npm-is-confusing-my-mautic-5-installation-process/33080/2 "2024-08-11T19:28:25Z")

</div>

It might be that you now have two versions of node installed and the mautic installation takes the node which is of wrong version.

As a quick workaround I would try spinning an official docker container for mautic and then just copy the source that is produced by the installation.

That way you do not have to deal with npm on the server.

---

<div class="post-metadata">

**Author:** ![bilbobaggage](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bilbobaggage/32/11406_2.png) [@bilbobaggage](https://forum.mautic.org/u/bilbobaggage)\
**Post date:** [August 12, 2024, 3:16pm UTC](https://forum.mautic.org/t/npm-is-confusing-my-mautic-5-installation-process/33080/3 "2024-08-12T15:16:39Z")

</div>

I would actually love a docker version, but afaik there’s no official docker support yet?

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [August 12, 2024, 3:24pm UTC](https://forum.mautic.org/t/npm-is-confusing-my-mautic-5-installation-process/33080/4 "2024-08-12T15:24:56Z")

</div>

[https://hub.docker.com/r/mautic/mautic](https://hub.docker.com/r/mautic/mautic) here’s the docker images 🙂

---

<div class="post-metadata">

**Author:** ![bilbobaggage](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bilbobaggage/32/11406_2.png) [@bilbobaggage](https://forum.mautic.org/u/bilbobaggage)\
**Post date:** [August 12, 2024, 6:28pm UTC](https://forum.mautic.org/t/npm-is-confusing-my-mautic-5-installation-process/33080/5 "2024-08-12T18:28:44Z")

</div>

Thank you, I’m finally able to install a dockerized version, however, it seems that the image is one version behind? What exactly is the process of updating here, since this is a docker version I assume we should never pull updates from the webapp’s UI?

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [August 12, 2024, 8:29pm UTC](https://forum.mautic.org/t/npm-is-confusing-my-mautic-5-installation-process/33080/6 "2024-08-12T20:29:09Z")

</div>

You specify mautic version in env. variable here:

> <https://github.com/mautic/docker-mautic/blob/99f825fa7e1083fa0cb156d91fd49ea95d68e384/fpm/Dockerfile#L40>

depending how you set other env. variables you may need to login to web container and execute migrations after the update.

---

<div class="post-metadata">

**Author:** ![bilbobaggage](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bilbobaggage/32/11406_2.png) [@bilbobaggage](https://forum.mautic.org/u/bilbobaggage)\
**Post date:** [August 13, 2024, 2:51am UTC](https://forum.mautic.org/t/npm-is-confusing-my-mautic-5-installation-process/33080/7 "2024-08-13T02:51:30Z")

</div>

I use [this compose template](https://github.com/mautic/docker-mautic/tree/mautic5/examples/basic) basically and the env variables have a different format. Do I just append those env variables you sent or is there something I need to configure in the compose file?

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [August 13, 2024, 7:03pm UTC](https://forum.mautic.org/t/npm-is-confusing-my-mautic-5-installation-process/33080/8 "2024-08-13T19:03:21Z")

</div>

I have not had time to fully test this myself, looking just add the Dockerfile MAUTIC\_VERSION is build argument, so change that argument to whatever version works for you, build an image and use it in compose.

I think format of version is the same as tags in git, so if you do MAUTIC\_VERSION=5.1.0 it will use source of mautic 5.

> <https://github.com/mautic/docker-mautic/blob/084bcee5cc963379a8c519fe2fad4df8eeb37615/fpm/Dockerfile>
