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

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 ?

Check if 4.4.10 → 5.0.1 fails because Symfony Path is not fount in ParameterLoader.php - #10 by peter_k helps

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

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

MAUTICROOT/config/local.php

Remember to execute the database migrations, etc.

@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.

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.

Nodjs : v12.22.9
NPM : 8.5.1

I’ll check if this is the issue …

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.

1 Like

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