Search code examples
symfonycomposer-php

How to install new Symfony 6.4.* webapp?


Attempts to install Symfony 6.4 (or 6.3) with symfony new diet-update --version=6.4.* --webapp fail with the message below.

Searches on the ultimate error message:

importmap:require returned with error code 1...Error setting certificate file: G:\Documents\workspace\cacert.pem for "https://data.jsdelivr.com/v1/packages/npm/@hotwired/stimulus/resolvedspecifier=%5E3.0.0

FWIW, the jsdelivr address returns:

{
    "type": "npm",
    "name": "@hotwired/stimulus",
    "version": "3.2.2",
    "links": {
        "self": "https://data.jsdelivr.com/v1/packages/npm/@hotwired/[email protected]",
        "entrypoints": "https://data.jsdelivr.com/v1/packages/npm/@hotwired/[email protected]/entrypoints",
        "stats": "https://data.jsdelivr.com/v1/stats/packages/npm/@hotwired/[email protected]"
    }
}

have not provided a solution.

symfony new diet-update --version=6.4.* --webapp returns:

* Creating a new Symfony 6.4.* project with Composer
  (running C:\ProgramData\ComposerSetup\bin\composer.phar create-project symfony/skeleton G:\workspace\diet-update 6.4.* --no-interaction)

* Setting up the project under Git version control
  (running git init G:\workspace\diet-update)

  (running C:\ProgramData\ComposerSetup\bin\composer.phar require webapp --no-interaction)

./composer.json has been updated
Running composer update symfony/webapp-pack
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "6.4.*"
Updating dependencies
Lock file operations: 106 installs, 0 updates, 0 removals
...
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 106 installs, 0 updates, 0 removals
...
Generating autoload files
119 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Symfony operations: 20 recipes (040c866cf81490589e0a1ea0e6ede855)
  - Configuring symfony/webapp-pack (>=1.0): From github.com/symfony/recipes:main
  - Configuring doctrine/doctrine-bundle (>=2.10): From github.com/symfony/recipes:main
  -  IGNORING  doctrine/doctrine-bundle (>=2.10): From github.com/symfony/recipes:main
  - Configuring doctrine/doctrine-migrations-bundle (>=3.1): From github.com/symfony/recipes:main
  - Configuring phpunit/phpunit (>=9.6): From github.com/symfony/recipes:main
  - Configuring symfony/debug-bundle (>=5.3): From github.com/symfony/recipes:main
  - Configuring symfony/messenger (>=6.0): From github.com/symfony/recipes:main
  - Configuring symfony/phpunit-bridge (>=6.3): From github.com/symfony/recipes:main
  - Configuring symfony/twig-bundle (>=6.3): From github.com/symfony/recipes:main
  - Configuring symfony/web-profiler-bundle (>=6.1): From github.com/symfony/recipes:main
  - Configuring symfony/validator (>=5.3): From github.com/symfony/recipes:main
  - Configuring symfony/stimulus-bundle (>=2.9): From github.com/symfony/recipes:main
  - Configuring symfony/ux-turbo (>=v2.13.2): From auto-generated recipe
  - Configuring twig/extra-bundle (>=v3.8.0): From auto-generated recipe
  - Configuring symfony/translation (>=6.3): From github.com/symfony/recipes:main
  - Configuring symfony/security-bundle (>=6.4): From github.com/symfony/recipes:main
  - Configuring symfony/notifier (>=5.0): From github.com/symfony/recipes:main
  - Configuring symfony/monolog-bundle (>=3.7): From github.com/symfony/recipes:main
  - Configuring symfony/maker-bundle (>=1.0): From github.com/symfony/recipes:main
  - Configuring symfony/mailer (>=4.3): From github.com/symfony/recipes:main
  - Configuring symfony/asset-mapper (>=6.4): From github.com/symfony/recipes:main
Executing script importmap:require [KO]
 [KO]
Script importmap:require returned with error code 1
!!
!!  In ErrorChunk.php line 56:
!!

!!    Error setting certificate file: G:\Documents\workspace\cacert.pem for "https://data.jsdelivr.com/v1/packages/npm/@h
!!    otwired/stimulus/resolved?specifier=%5E3.0.0".

!!

!!
!!  In CurlResponse.php line 316:
!!

!!    Error setting certificate file: G:\Documents\workspace\cacert.pem for "https://data.jsdelivr.com/v1/packages/npm/@h
!!    otwired/stimulus/resolved?specifier=%5E3.0.0".

!!

!!
!!  importmap:require [--entrypoint] [--path PATH] [--] <packages>...
!!
!!


  unable to run C:\ProgramData\ComposerSetup\bin\composer.phar require webapp --no-interaction

Solution

  • The culprit appears to be php! Version 8.2.10 failed, backing off to 8.1.9 allowed installation to complete. May experiment with 8.2 versions.

    Edit: 8.2.14 also fails.

    Edit #2: The fundamental problem is likely not PHP; the issue seems to revolve around Symfony's AssetMapper. Not sure how I did it, but my installation of Symfony 6.4.1 does not include AssetMapper. When it's installed, importmap.php arrives, and that, for whatever reason, triggers the ...cacert.pem error.

    Constructive suggestions welcome. Only.

    Edit #3: It appears to be sequence dependent. I added AssetMapper while the project was at Symfony 6.3. Then updated PHP to 8.2 & Symfony to 6.4. Everybody (I hope) is happy now.

    Edit #4: PHP version 8.3 does NOT throw the ...cacert.pem error either.