# Switching to Composer (mautic 5) - npx patch-package issue

**URL:** <https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564>\
**Category:** Mautic 5 Install/Upgrade Support\
**Created:** [January 19, 2024, 8:44am UTC](https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564 "2024-01-19T08:44:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lexgabrees](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lexgabrees/32/4467_2.png) [@lexgabrees](https://forum.mautic.org/u/lexgabrees)\
**Post date:** [January 19, 2024, 8:44am UTC](https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564/1 "2024-01-19T08:44:34Z")

</div>

Trying to switch Mautic 5.02 to a composer version isn’t working for me.

(mind you, I’m no composer wizard, but I’ve followed all the instructions precisely).

After running the composer create-project command, I’m getting the following exit code:

> 73 packages are looking for funding  
> run `npm fund` for details
> 
> > npx patch-package  
> > /var/www/ma.lexgabrees.com/htdocs-new/node\_modules/patch-package/node\_modules/yaml/dist/compose/composer.js:33  
> > if (prelude[i + 1]?.[0] !== ‘#’)  
> > ^
> 
> SyntaxError: Unexpected token ‘.’  
> at wrapSafe (internal/modules/cjs/loader.js:915:16)  
> at Module.\_compile (internal/modules/cjs/loader.js:963:27)  
> at Object.Module.\_extensions…js (internal/modules/cjs/loader.js:1027:10)  
> at Module.load (internal/modules/cjs/loader.js:863:32)  
> at Function.Module.\_load (internal/modules/cjs/loader.js:708:14)  
> at Module.require (internal/modules/cjs/loader.js:887:19)  
> at require (internal/modules/cjs/helpers.js:74:18)  
> at Object. (/var/www/ma.lexgabrees.com/htdocs-new/node\_modules/patch-package/node\_modules/yaml/dist/index.js:3:16)  
> at Module.\_compile (internal/modules/cjs/loader.js:999:30)  
> at Object.Module.\_extensions…js (internal/modules/cjs/loader.js:1027:10)  
> **Script npx patch-package handling the npx-patch-package event returned with error code 1**  
> **Script @npx-patch-package was called via post-update-cmd**

Anybody have an idea ?

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [January 19, 2024, 12:39pm UTC](https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564/2 "2024-01-19T12:39:49Z")

</div>

Check if [4.4.10 → 5.0.1 fails because Symfony Path is not fount in ParameterLoader.php - #10 by peter\_k](https://forum.mautic.org/t/4-4-10-5-0-1-fails-because-symfony-path-is-not-fount-in-parameterloader-php/30475/10) helps

---

<div class="post-metadata">

**Author:** ![lexgabrees](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lexgabrees/32/4467_2.png) [@lexgabrees](https://forum.mautic.org/u/lexgabrees)\
**Post date:** [January 19, 2024, 4:21pm UTC](https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564/3 "2024-01-19T16:21:59Z")

</div>

I’ll check that thanks … However, I already have 5.02 installed (upgraded from 4.x through the command line). I just need to switch it to a composer installation …

I am following these instructions :

[https://docs.mautic.org/en/5.x/getting\_started/switching\_composer.html](https://docs.mautic.org/en/5.x/getting_started/switching_composer.html)

So, it’s a clean install, and I would copy the config file into, and use the existing DB

---

<div class="post-metadata">

**Author:** ![peter\_k](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/peter_k/32/511_2.png) [@peter\_k](https://forum.mautic.org/u/peter_k)\
**Post date:** [January 19, 2024, 5:06pm UTC](https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564/4 "2024-01-19T17:06:42Z")

</div>

> [@lexgabrees](#):
>
> where I would copy the config file into, and use the existing DB

MAUTICROOT/config/local.php

Remember to execute the database migrations, etc.

---

<div class="post-metadata">

**Author:** ![mollux](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mollux/32/10618_2.png) [@mollux](https://forum.mautic.org/u/mollux)\
**Post date:** [January 19, 2024, 6:49pm UTC](https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564/5 "2024-01-19T18:49:15Z")

</div>

@lexgabrees can you specify the nodejs and npm version you’re using?

I googled the `SyntaxError: Unexpected token ‘.’` error with the file `yaml/dist/compose/composer.js`, and got some results related to package and nodejs version.

---

<div class="post-metadata">

**Author:** ![lexgabrees](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lexgabrees/32/4467_2.png) [@lexgabrees](https://forum.mautic.org/u/lexgabrees)\
**Post date:** [January 20, 2024, 7:19am UTC](https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564/6 "2024-01-20T07:19:02Z")

</div>

Locations aren’t the issue and migrations are already done … I’m running 5.02, and only trying to switch to a composer installation byt installing a new mautic instance, and copying the config files.

---

<div class="post-metadata">

**Author:** ![lexgabrees](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lexgabrees/32/4467_2.png) [@lexgabrees](https://forum.mautic.org/u/lexgabrees)\
**Post date:** [January 20, 2024, 7:19am UTC](https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564/7 "2024-01-20T07:19:44Z")

</div>

Nodjs : v12.22.9  
NPM : 8.5.1

I’ll check if this is the issue …

---

<div class="post-metadata">

**Author:** ![lexgabrees](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lexgabrees/32/4467_2.png) [@lexgabrees](https://forum.mautic.org/u/lexgabrees)\
**Post date:** [January 20, 2024, 7:52am UTC](https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564/8 "2024-01-20T07:52:37Z")

</div>

So the version was the issue.

I used Snap to install the latest stable version of Nodjs (20.11.0 LTS) and this version works without any errors.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [January 25, 2024, 10:53pm UTC](https://forum.mautic.org/t/switching-to-composer-mautic-5-npx-patch-package-issue/30564/9 "2024-01-25T22:53:44Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
