Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PackageJsonSynchronizer error when configuring symfony/ux-chartjs (>=v2.31.0) #1074

@fabgg

Description

@fabgg

Hello,

I’m trying to install symfony/ux-chartjs. Just before that, I upgraded my project to Symfony 7.4.*.
The Symfony Flex bundle is in version v2.10.0, and ux-chartjs is in v2.31.0.

During the Composer installation, I get the following error:

Symfony operations: 1 recipe (10c8450d5f6cd321a351399032a77ff4)
  - Configuring symfony/ux-chartjs (>=v2.31.0): From auto-generated recipe

In PackageJsonSynchronizer.php line 107:
                                                      
  Trying to access array offset on value of type int  

To quickly move forward, I temporarily modified PackageJsonSynchronizer.php at line 107 to avoid the error.

It looks like the issue might be related to an unexpected value in the package.json handling within the ux-chartjs bundle.

// before
if ('@' !== $name[0] || !str_starts_with($version, 'file:'.$this->vendorDir.'/') || !str_contains($version, '/assets')) {
    continue;
}

// after
if ((is_array($name) && '@' !== $name[0]) || !str_starts_with($version, 'file:'.$this->vendorDir.'/') || !str_contains($version, '/assets')) {
    continue;
}

Please let me know if you need more details or a reproducible example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions