• Resolved sduoduo

    (@sduoduo)


    I installed wordpress using docker and I got “This block has encountered an error and cannot be previewed.” when I am editing the default theme using the site editor. There is no plugin enabled and the theme I am using is Twenty Twenty-Three.

    JS console log:

    TypeError: _.labels is undefined
        edit https://***/wp-includes/js/dist/block-library.min.js?ver=3115f0b5551a55bb6d3b:14
        kt https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        js https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        kl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        yl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        vl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        ol https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        cl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        zn https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        al https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
    react-dom.min.js:10:53541
    TypeError: f.labels is undefined
        edit https://***/wp-includes/js/dist/block-library.min.js?ver=3115f0b5551a55bb6d3b:14
        kt https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        js https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        kl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        yl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        vl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        ol https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        cl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        zn https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        al https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
    react-dom.min.js:10:53541
    TypeError: _.labels is undefined
        edit https://***/wp-includes/js/dist/block-library.min.js?ver=3115f0b5551a55bb6d3b:14
        kt https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        js https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        kl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        yl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        vl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        ol https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        cl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        zn https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        xl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        Sl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        v https://***/wp-includes/js/dist/vendor/react.min.js?ver=18.2.0:10
        ce https://***/wp-includes/js/dist/vendor/react.min.js?ver=18.2.0:10
        <anonymous> https://***/wp-admin/load-scripts.php?c=1&load[chunk_0]=hoverIntent,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.2:5
        P https://***/wp-admin/load-scripts.php?c=1&load[chunk_0]=hoverIntent,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.2:5
        E https://***/wp-admin/load-scripts.php?c=1&load[chunk_0]=hoverIntent,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.2:5
    react-dom.min.js:10:53541
    TypeError: f.labels is undefined
        edit https://***/wp-includes/js/dist/block-library.min.js?ver=3115f0b5551a55bb6d3b:14
        kt https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        js https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        kl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        yl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        vl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        ol https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        cl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        zn https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        xl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        Sl https://***/wp-includes/js/dist/vendor/react-dom.min.js?ver=18.2.0:10
        v https://***/wp-includes/js/dist/vendor/react.min.js?ver=18.2.0:10
        ce https://***/wp-includes/js/dist/vendor/react.min.js?ver=18.2.0:10
        <anonymous> https://***/wp-admin/load-scripts.php?c=1&load[chunk_0]=hoverIntent,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.2:5
        P https://***/wp-admin/load-scripts.php?c=1&load[chunk_0]=hoverIntent,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.2:5
        E https://***/wp-admin/load-scripts.php?c=1&load[chunk_0]=hoverIntent,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.2:5

    Docker compose:

    version: "3"
    
    services:
      db:
        image: mariadb:latest
        volumes:
          - /srv/wp-db:/var/lib/mysql
        environment:
          - MYSQL_ROOT_PASSWORD=***
          - MYSQL_USER=wordpress
          - MYSQL_PASSWORD=***
          - MYSQL_DATABASE=wordpress
    
      wp:
        image: wordpress:fpm
        volumes:
          - /srv/wp:/var/www/html
    
      nginx:
        image: nginx:alpine
        volumes:
          - /srv/wp-nginx:/etc/nginx/conf.d
          - /srv/wp:/var/www/html
          - /srv/wp-cert:/cert
        ports:
          - 443:443
          - 80:80
    
      pma:
        image: phpmyadmin:latest
        environment:
          - PMA_ABSOLUTE_URI=https://***/pma/
    
    

    Nginx:

    server {
      listen 80;
      listen 443 ssl http2;
    
      ssl_certificate /cert/fullchain.pem;
      ssl_certificate_key /cert/privkey.pem;
    
      server_name ***;
    
      root /var/www/html;
      index index.php;
    
      location / {
        try_files $uri $uri/ /index.php?q=$uri$args;
      }
    
      location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass wp:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
      }
    
      location ^~ /pma {
        rewrite ^/pma(/.*)$ $1 break;
        proxy_pass https://pma:80;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
      }
    }

    How do I fix this? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Kai Hao

    (@kevin940726)

    I can’t seem to reproduce it. Could you share the url when the error happened? You could also try recreating the docker instance from scratch and see if the error still occurs.

    Thread Starter sduoduo

    (@sduoduo)

    I can’t seem to reproduce it. Could you share the url when the error happened? You could also try recreating the docker instance from scratch and see if the error still occurs.

    Thanks for your reply. I changed the docker image from wordpress:fpm to wordpress:latest and now the problem is fixed. I think it might be a problem to do with nginx php config.

    Thread Starter sduoduo

    (@sduoduo)

    I met this error again and I FINALLY resolved this issue. It is a mistake in the nginx config file.

      location / {
        try_files $uri $uri/ /index.php?$args; # <- change here
      }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error: This block has encountered an error and cannot be previewed.’ is closed to new replies.