Support » Plugin: AMP » Error on Updating to the Latest Version of Plugin

  • Resolved kanuj

    (@kanuj)


    ‘You appear to be running the AMP plugin from source. Please do composer install && npm install && npm run build to finish installation.’

    Getting the above error when updating to the latest version of the plugin.

    I installed the plugin from WordPress Dashboard.

    Deleted it and then manually uploaded to the plugins folder using SFTP.

    Still the error is there. Finally have reverted back to the previous version from backup.

    I have never installed any plugin using Git. What could be the reason for this. Using it with the Newspaper Theme from Tagdiv. Latest Version.

    Any Help appreciated in this matter.

    Regards
    Kanuj

Viewing 15 replies - 1 through 15 (of 28 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    @kanuj Is your WordPress install being managed by version control?

    Can you check and see if you have a .gitignore which has vendor directory. If so change vendor to /vendor (so that it only ignores your project’s vendor files.)

    You can find more information on that error message on GitHub.

    Thanks James for the help – I saw the solution asked by someone else in the past but unfortunately it is not working for me.

    I found the .gitignore file in the wp-content/themes folder.

    One of the earlier developers was using git to make some changes to a theme. Now he is not working anymore.

    Can you please share how can I revoke access to git for my website or how can I make AMP plugin work.

    I checked the .gitignore file. There was no mention of vendor directory inside the .gitignore file.

    I added the /vendor inside it and saved it but the error is still showing.

    Also, I was using the version 1.13 without any issues or all the previous versions. The issue has come with the version 1.2 update only.

    • This reply was modified 7 months, 1 week ago by Andrew Nevins.
    • This reply was modified 7 months, 1 week ago by kanuj.

    I’m having the same problem but my WP is NOT being managed by version control. I checked my entire account and other than three plugins, there’s no instance of .gitignore on my server.

    It’s the exact same issue that @kanuj is reeporting. Was working fine at 1.13 but 1.2 caused the issue. Had to disable the plugin because of it.

    Plugin Author Weston Ruter

    (@westonruter)

    Can you try re-installing the plugin from WordPress.org then? Perhaps you were served an incomplete archive.

    Just to be safe, I checked all of the .gitignore files on my server and all either have the /vendor line or don’t mention the vendor directory at all. This clearly isn’t the resolution for me.

    I’ve deleted and reinstalled three times with no luck.

    Plugin Author Weston Ruter

    (@westonruter)

    How are you installing the plugin? Via the normal plugin installation flow?

    Just to be sure, can you download amp.zip from https://wordpress.org/plugins/amp/ via the Download link and then install the ZIP into WordPress via the “Add New” screen and click “Upload” to supply the ZIP and then activate.

    If that still doesn’t work, then this is the code in question that is detecting whether or not the plugin is fully intact:

    https://github.com/ampproject/amp-wp/blob/cb0c7e324f92ce5523378fee923fb7677f9acd1b/amp.php#L148

    if ( ! file_exists( __DIR__ . '/vendor/autoload.php' ) || ! file_exists( __DIR__ . '/vendor/sabberworm/php-css-parser' ) || ! file_exists( __DIR__ . '/assets/js/amp-block-editor.js' ) ) {

    So I then suggest adding these lines before that line to just be sure what the specific problem is:

    if ( ! file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
    	$_amp_load_errors->add( 'missing_autoload', 'Missing vendor/autoload.php' );
    }
    if ( ! file_exists( __DIR__ . '/vendor/sabberworm/php-css-parser' ) ) {
    	$_amp_load_errors->add( 'missing_php_css_parser', 'Missing php-css-parser' );
    }
    if ( ! file_exists( __DIR__ . '/assets/js/amp-block-editor.js' ) ) {
    	$_amp_load_errors->add( 'missing_amp_block_editor', 'Missing assets/js/amp-block-editor.js' );
    }
    • This reply was modified 7 months, 1 week ago by Weston Ruter.

    Dear Weston,

    After installing from the wp dashboard. I did exactly as mentioned below.
    Just to be sure, can you download amp.zip from https://wordpress.org/plugins/amp/ via the Download link and then install the ZIP into WordPress via the “Add New” screen and click “Upload” to supply the ZIP and then activate.

    This is what i tried before opening this ticket.

    I Will edit the code as shared by you and report back soon. 😃

    Thanks
    Kanuj

    This is peculiar. Adding the code did change the error message but not the way I think you were trying. Now even a clean version of the plugin generates this message:

    Fatal error: Uncaught Error: Undefined class constant ‘AMP_Theme_Support::READER_MODE_SLUG’ in /home/plagiari/public_html/wp-content/plugins/amp/includes/options/class-amp-options-manager.php:119 Stack trace: #0 /home/plagiari/public_html/wp-content/plugins/amp/includes/options/class-amp-options-manager.php(168): AMP_Options_Manager::get_options() #1 /home/plagiari/public_html/wp-content/plugins/amp/includes/class-amp-theme-support.php(169): AMP_Options_Manager::get_option(‘theme_support’) #2 /home/plagiari/public_html/wp-content/plugins/amp/includes/class-amp-theme-support.php(126): AMP_Theme_Support::read_theme_support() #3 /home/plagiari/public_html/wp-content/plugins/amp/amp.php(350): AMP_Theme_Support::init() #4 /home/plagiari/public_html/wp-content/plugins/amp/amp.php(269): amp_init() #5 /home/plagiari/public_html/wp-includes/class-wp-hook.php(286): amp_activate(”) #6 /home/plagiari/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array) #7 /home/plagiari/public_html/wp-includes/plugin.php in /home/plagiari/public_html/wp-content/plugins/amp/includes/options/class-amp-options-manager.php on line 119

    Nothing has really changed that I’m aware of.

    I’m using git to version control and deploy my theme. The only item in my .gitignore file is node_modules.

    My production site is receiving the same error as above. I’m running the latest version of WordPress.

    I have two development sites running on the same server that are not receiving this error. the three sites differ in which plugins are active, but the theme is the same.

    I added the code that Weston mentioned above, but it did not alter the error message.

    In the mean time, I rolled back the plugin to the previous version.

    • This reply was modified 7 months, 1 week ago by jfarruggio.
    Plugin Author Weston Ruter

    (@westonruter)

    @plagiarismtoday it seems you have some files from 1.1.3 and others from 1.2.0

    @jfarruggio it doesn’t make sense that adding those lines would not change the error message, since those lines are breaking up the one conditional into multiple.

    Hmm tried the above code in amp.php.

    I deleted the existing plugin using SFTP and downloaded the Zip from https://wordpress.org/plugins/amp/

    uploaded it using the WordPress plugin import.

    Then

    I deleted the below code:

    if ( ! file_exists( __DIR__ . ‘/vendor/autoload.php’ ) || ! file_exists( __DIR__ . ‘/vendor/sabberworm/php-css-parser’ ) || ! file_exists( __DIR__ . ‘/assets/js/amp-block-editor.js’ ) ) {

    and added this instead:

    if ( ! file_exists( __DIR__ . ‘/vendor/autoload.php’ ) ) {
    $_amp_load_errors->add( ‘missing_autoload’, ‘Missing vendor/autoload.php’ );
    }
    if ( ! file_exists( __DIR__ . ‘/vendor/sabberworm/php-css-parser’ ) ) {
    $_amp_load_errors->add( ‘missing_php_css_parser’, ‘Missing php-css-parser’ );
    }
    if ( ! file_exists( __DIR__ . ‘/assets/js/amp-block-editor.js’ ) ) {
    $_amp_load_errors->add( ‘missing_amp_block_editor’, ‘Missing assets/js/amp-block-editor.js’ );
    }

    Still, the error is there, doesn’t work as intended.

    Note:- it did not alter the error message.

    • This reply was modified 7 months, 1 week ago by kanuj.
    • This reply was modified 7 months, 1 week ago by kanuj.
    Plugin Author Weston Ruter

    (@westonruter)

    Which error specifically? Is one of the three error messages that you added? Or is it the original error message?

    I wonder if you have two copies of the AMP plugin installed?

    Plugin Author Weston Ruter

    (@westonruter)

    @kanuj if it didn’t alter the error message, then you may have two copies of the plugin installed. If you remove something from the plugin but that thing remains, then something else is going on. Perhaps you have a PHP opcache that needs to be flushed.

    Plugin Author Weston Ruter

    (@westonruter)

    Make sure that there is only one copy of the plugin in the plugins directory and that it is called amp.

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Error on Updating to the Latest Version of Plugin’ is closed to new replies.