Installation error with composer: Field 'browser' doesn't contain a valid alias configuration

Your software
My Mautic version is: 5.0.3
My PHP version is: 8.1.27
My Database type and version is: MariaDB 10.11.6

Your problem
My problem is: I’m trying to install Mautic 5 via recommended Composer

Steps:

  1. Downloaded and unzipped 5.0.3 zip file
  2. composer create-project mautic/recommended-project:^5 mautic --no-interaction => OK
  3. composer install => Error

These errors are showing in the log:

In short:
Field ‘browser’ doesn’t contain a valid alias configuration

From the log:

> mautic@0.0.0 postinstall
> node_modules/modernizr/bin/modernizr -c modernizr-config.json -d node_modules/modernizr/modernizr-mautic-dist.js & npm run build

Modernizr build saved to node_modules/modernizr/modernizr-mautic-dist.js

> mautic@0.0.0 build
> webpack --mode production  --config webpack.config.js

[CKEditorTranslationsPlugin] Error: No translation has been found for the en language.
assets by status 1.23 MiB [cached] 1 asset
cached modules 9.81 MiB (javascript) 919 bytes (runtime) [cached] 1615 modules

ERROR in ./app/assets/libraries/ckeditor/src/ckeditor.ts 31:0-40
Module not found: Error: Can't resolve './TokenPlugin' in '/usr/local/www/nginx-dist/mautic.example.com/app/assets/libraries/ckeditor/src'
resolve './TokenPlugin' in '/usr/local/www/nginx-dist/mautic.example.com/app/assets/libraries/ckeditor/src'
  using description file: /usr/local/www/nginx-dist/mautic.example.com/package.json (relative path: ./app/assets/libraries/ckeditor/src)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /usr/local/www/nginx-dist/mautic.example.com/package.json (relative path: ./app/assets/libraries/ckeditor/src/TokenPlugin)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /usr/local/www/nginx-dist/mautic.example.com/app/assets/libraries/ckeditor/src/TokenPlugin doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /usr/local/www/nginx-dist/mautic.example.com/app/assets/libraries/ckeditor/src/TokenPlugin.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /usr/local/www/nginx-dist/mautic.example.com/app/assets/libraries/ckeditor/src/TokenPlugin.js doesn't exist
      .json
        Field 'browser' doesn't contain a valid alias configuration
        /usr/local/www/nginx-dist/mautic.example.com/app/assets/libraries/ckeditor/src/TokenPlugin.json doesn't exist
      as directory
        /usr/local/www/nginx-dist/mautic.example.com/app/assets/libraries/ckeditor/src/TokenPlugin doesn't exist

webpack 5.88.2 compiled with 1 error in 3870 ms
npm ERR! code 1
npm ERR! path /usr/local/www/nginx-dist/mautic.example.com
npm ERR! command failed
npm ERR! command sh -c node_modules/modernizr/bin/modernizr -c modernizr-config.json -d node_modules/modernizr/modernizr-mautic-dist.js & npm run build

Steps I have tried to fix the problem:

  • I have tried to clean cache and reinstall Mautic
  • I have executed: npx update-browserslist-db@latest

… I’m not a JavaScript/NPM/Webpack/Modernizer expert,
so I’m not sure how to fix this error.

Does anyone know, how to fix that?

1 Like

So I have found that on my VPS one filename from the 5.0.3 zip file was “decapitalized” at some point:

TokenPlugin.ts => tokenplugin.ts

Not sure what was the reason (wrong unzipping? / some npm-ing?).

Now the webpack builds ok.

1 Like

Hello
I have this problem in Mautic5 installation, can any one help me to resolve this issue

1 - Install web server environment with PHP8.2
2- download and install with composer : composer result is good
3 - in my Navigator I have the message to downgrade the earlier version of PHP
4- I have installed the PHP8.1 in the same server
==> Result : 500 error

5- composer update --with-all-dependencies

Do not run Composer as root/super user! See How do I install untrusted packages safely? Is it safe to run Composer as superuser or root? - Composer for details
Continue as root/super user [yes]? yes
Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.
Loading composer repositories with package information
https://repo.packagist.org could not be fully loaded (The “https://repo.packagist.org/p2/helios-ag/fm-elfinder-bundle.json” file could not be downloaded: Failed to open stream: Network is unreachable), package information was loaded from the local cache and may be out of date
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1

  • Root composer.json requires mautic/core-lib 5.0.0-rc1 → satisfiable by mautic/core-lib[5.0.0-rc1].
  • mautic/core-lib 5.0.0-rc1 requires ext-zip * → it is missing from your system. Install or enable PHP’s zip extension.
    Problem 2
  • mautic/core-lib 5.0.0-rc1 requires ext-zip * → it is missing from your system. Install or enable PHP’s zip extension.
  • mautic/theme-trulypersonal 5.0.0-rc1 requires mautic/core-lib ^5.0 → satisfiable by mautic/core-lib[5.0.0-rc1].
  • Root composer.json requires mautic/theme-trulypersonal 5.0.0-rc1 → satisfiable by mautic/theme-trulypersonal[5.0.0-rc1].

To enable extensions, verify that they are enabled in your .ini files:

  • /etc/php/8.3/cli/php.ini
  • /etc/php/8.3/cli/conf.d/10-mysqlnd.ini
  • /etc/php/8.3/cli/conf.d/10-opcache.ini
  • /etc/php/8.3/cli/conf.d/10-pdo.ini
  • /etc/php/8.3/cli/conf.d/15-xml.ini
  • /etc/php/8.3/cli/conf.d/20-calendar.ini
  • /etc/php/8.3/cli/conf.d/20-ctype.ini
  • /etc/php/8.3/cli/conf.d/20-dom.ini
  • /etc/php/8.3/cli/conf.d/20-exif.ini
  • /etc/php/8.3/cli/conf.d/20-ffi.ini
  • /etc/php/8.3/cli/conf.d/20-fileinfo.ini
  • /etc/php/8.3/cli/conf.d/20-ftp.ini
  • /etc/php/8.3/cli/conf.d/20-gettext.ini
  • /etc/php/8.3/cli/conf.d/20-iconv.ini
  • /etc/php/8.3/cli/conf.d/20-imap.ini
  • /etc/php/8.3/cli/conf.d/20-mbstring.ini
  • /etc/php/8.3/cli/conf.d/20-mysqli.ini
  • /etc/php/8.3/cli/conf.d/20-pdo_mysql.ini
  • /etc/php/8.3/cli/conf.d/20-phar.ini
  • /etc/php/8.3/cli/conf.d/20-posix.ini
  • /etc/php/8.3/cli/conf.d/20-readline.ini
  • /etc/php/8.3/cli/conf.d/20-shmop.ini
  • /etc/php/8.3/cli/conf.d/20-simplexml.ini
  • /etc/php/8.3/cli/conf.d/20-sockets.ini
  • /etc/php/8.3/cli/conf.d/20-sysvmsg.ini
  • /etc/php/8.3/cli/conf.d/20-sysvsem.ini
  • /etc/php/8.3/cli/conf.d/20-sysvshm.ini
  • /etc/php/8.3/cli/conf.d/20-tokenizer.ini
  • /etc/php/8.3/cli/conf.d/20-xmlreader.ini
  • /etc/php/8.3/cli/conf.d/20-xmlwriter.ini
  • /etc/php/8.3/cli/conf.d/20-xsl.ini
    You can also run php --ini in a terminal to see which files are used by PHP in CLI mode.
    Alternatively, you can run Composer with --ignore-platform-req=ext-zip to temporarily ignore these required extensions.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Error message with composer update

Make sure you use PHP 8.1 (your log shows 8.3).

Then you have to install all php extensions required for Mautic.

IDK if there is a complete updated list of them somewhere, but install them till you get rid of all errors.

Your log above shows you need to install: php8.1-zip extension
… repeat => get error => install another => repeat

The php8.1-zip extension is installed but maybe the configuratuion of PHP versions make errors

i have another platform worked in the same server

there is a command how delete composer installation ? I have to repeat the process in the bigining ?

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