Error: sed not present, please install sed


  • | 647 points

    I have finally got WP CLI working (by adding each missing path manually - Laragon does NOT manage PATH at least not for me it seems, despite what is said elsewherehere).

    Now when running wp mu-migration I get
    Error: sed not present, please install sed
    How do I install SED please?


  • administrators
    | 111171 points

    @patbell101 : I answered your question here:
    https://forum.laragon.org/topic/1039/tutorial-how-to-add-wp-cli-to-laragon

    If you don't fix the init.bat issue, you will face other nuisances.


  • administrators
    | 111171 points

    @patbell101 : After fixing the terminal issue, you can add sed easily by clicking Menu > Tools > Quick add > git


  • | 647 points

    @leokhoa I reinstalled laragon (which I presume you meant) and no longer get the init.bat error but I still get the sed error for my OP

    0_1562084501782_upload-c7441e68-3fbb-4190-9f72-955c292fce70

    So I ask again - how do I install SED?

    and/or what does the undefined index error mean?


  • administrators
    | 111171 points

    @patbell101 : Did you read my instruction and follow?
    @leokhoa said in Error: sed not present, please install sed:

    @patbell101 : After fixing the terminal issue, you can add sed easily by clicking Menu > Tools > Quick add > git


  • | 647 points

    I have added git as you instructed before but still get the message about sed. I have refollowed all the wpcli implementation instructions and your additional ones too.

    fwiw I have reinstalled over and reinstalled git. Looking at the laragon path in tools shows an entry C:\laragon\bin\git\usr\bin which is where SED resides. So its in the path and typing SED on its own shows no problem. Is this a problem with MU-MIGRATION then? Which is the only reason I want WP-CLI at all.
    0_1562151043765_upload-1e12b424-9517-43c3-b8ae-8a2e88dd9de6


  • administrators
    | 111171 points

    @patbell101 : I guess so. If you want to make sure, you can check its source code.


  • | 647 points

    @leokhoa - looking on git I can see that the function that erroneously generates the error is as copied below. My coding skills do not enable me to figure out the problem nor comment out and install an edited package. Perhaps you can understand the function sufficiently to advise a fix on the laragon end of things?

    /**
    * Checks whether sed is available or not.
    *
    * @param bool $exit_on_error If set to true the script will be terminated if sed is not available.
    * @return bool
    */
    private function check_for_sed_presence( $exit_on_error = false ) {
    $sed = \WP_CLI::launch( 'echo "wp_" | sed "s/wp_/wp_5_/g"', false, true );
    if ( 'wp_5_' !== trim( $sed->stdout, "\x0A" ) ) {
    if ( $exit_on_error ) {
    \WP_CLI::error( __( 'sed not present, please install sed', 'mu-migration' ) );
    }
    return false;
    }
    return true;
    }
    }


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.