Search code examples
phpcomposer-phpcodeigniter-3vfs-stream

CodeIgniter 3 - Composer Update Error - vfsstream


When running composer update for my CodeIgniter 3 project, I get the following error:

  1. > sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php
  2. sed: 1: "vendor/mikey179/vfsstre ...": invalid command code v
  3. Script sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php handling the post-update-cmd event returned with error code 1

I have previously corrected the uppercase error with vfsStream 1, 2.

Composer version: 2.3.9 Running on: Mac and Heroku-22

Composer.json extract from the CodeIgniter 3 framework:

"scripts": {
  "test:coverage": [
    "@putenv XDEBUG_MODE=coverage",
    "phpunit --color=always --coverage-text --configuration tests/travis/sqlite.phpunit.xml"
  ],
  "post-install-cmd": [
    "sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php"
  ],
  "post-update-cmd": [
    "sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php"
  ]
},

Solution

  • You are asking about a Composer Script that has been configured in your project within the Composer configuration file named composer.json by default (you have not shared which configuration file (you have), so please bear with me I can only state the default one).

    While Composer was executing that script it detected that the script did not run successfully (sometimes referred to as EXIT_SUCCESS).

    Therefore Composer displays the error message about the fact and the script in question.

    That is what you're seeing.

    The resolution of that requires to look at the actual script and debug it. Otherwise it is always an option that you remove any scripts you don't want, e.g. because they don't work for you.

    This is rather straight forward: Open the configuration file in question (composer.json by default), locate the Scripts Section and within it, the post-update-cmd entry. Fix or remove it.

    If you have received this piece of code under a specific license or contract, consult it for your dedicated support options.

    If you want to learn about the actual script command, consult the manual of the commands in use. Specifically the manual of sed(1) which emits the error message Composer echoes:

    1. sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php
    2. sed: 1: "vendor/mikey179/vfsstre ...": invalid command code v

    You're (perhaps) running the Composer transaction on a Mac computer:

    But that is only one of the many probabilities that may explain what sed(1) tells here, composer(1) only echoes that message.