mherchel / olivero-subtheme

How to sub-theme the new Drupal Olivero theme.
27 stars 5 forks source link

Syntax error: "(" unexpected #1

Open CangurinLimpiezasZaragoza opened 3 years ago

CangurinLimpiezasZaragoza commented 3 years ago

hi, i execute "sh ./build.sh" and put the name of the new theme ang get the next error, any idea? thanks

Enter the name of the theme (example: Mytheme): oliverosubfinal

./build.sh: 23: Syntax error: "(" unexpected

a-fro commented 3 years ago

Ran into the same issue when testing.

a-fro commented 3 years ago

Ok. I think I figured out the starting point. I was running this in a Linux environment, which defaults to dash instead of bash.

By calling bash ~/build.sh instead of sh ~/build.sh, the script completed, with some errors. I’m including those below. I haven’t yet taken the theme for a spin, but I can confirm that the files were renamed, etc, so hoping to report some good news after further testing.

sed: can't read : No such file or directory
sed: can't read : No such file or directory
sed: -e expression #1, char 1: unknown command: `.'
sed: -e expression #1, char 1: unknown command: `.'
rm: cannot remove '*.bak': No such file or directory
druplash commented 3 years ago

Have you already been able to find out something? When I run the command sh ./build.sh under CentOS, I get the same error message. The files are generated, but no header or footer can be seen in the frontend.

sed: kann nicht lesen: Datei oder Verzeichnis nicht gefunden sed: kann nicht lesen: Datei oder Verzeichnis nicht gefunden sed: -e Ausdruck #1, Zeichen 1: Unbekannter Befehl:.' sed: -e Ausdruck #1, Zeichen 1: Unbekannter Befehl: .' rm: das Entfernen von „*.bak“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden

a-fro commented 3 years ago

Did you try running bash ./build.sh instead of sh ./build.sh? That worked for me.

a-fro commented 3 years ago

The only other issue I ran into is that I had to follow step 4 from the manual instructions Copy the Theme Directory:

Within the coco.info.yml file, replace experimental: true with core_version_requirement: ^9

druplash commented 3 years ago

I get the same error with both variants. I really have no idea what the problem is.

druplash commented 3 years ago

After creating all files via sh script and setting theme as default i get this error in Drupal backend:

TypeError: Drupal\Core\Render\Renderer::doTrustedCallback(): Argument #1 ($callback) must be of type callable, array given, called in /var/www/vhosts/test/httpdocs/core/lib/Drupal/Core/Render/Renderer.php on line 781 in Drupal\Core\Render\Renderer->doTrustedCallback() (line 51 of /var/www/vhosts/test/httpdocs/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php)

druplash commented 3 years ago

Does anybody has an idea? Thanks

abrlam commented 3 years ago

Ok. I think I figured out the starting point. I was running this in a Linux environment, which defaults to dash instead of bash.

By calling bash ~/build.sh instead of sh ~/build.sh, the script completed, with some errors. I’m including those below. I haven’t yet taken the theme for a spin, but I can confirm that the files were renamed, etc, so hoping to report some good news after further testing.

sed: can't read : No such file or directory
sed: can't read : No such file or directory
sed: -e expression #1, char 1: unknown command: `.'
sed: -e expression #1, char 1: unknown command: `.'
rm: cannot remove '*.bak': No such file or directory

I had the same problem. I removed the extra space -i and .bak and it worked.

Before

sed -i .bak 's/package: Core/core_version_requirement: ^9/g' *.info.yml
sed -i .bak 's/experimental: true//g' *.info.yml

After

sed -i.bak 's/package: Core/core_version_requirement: ^9/g' *.info.yml
sed -i.bak 's/experimental: true//g' *.info.yml
CangurinLimpiezasZaragoza commented 3 years ago

hi, in drupal 9.2.0-alpha1 i try @abrlam solution calling bash ~/build.sh install ok , only get this errors sed: cannot be read: The file or directory does not exist sed:cannot be read: The file or directory does not exist the files are generated in theme folder, and i can activate the theme in apperance

the admin area is ok, but if navigate for the rest of the site i get blank page with "The website encountered an unexpected error. Please try again later." message.

in dblog i get the next error.

http://www.localhost/c19052021/admin/content?title=&type=nuestros_servicios&status=All&langcode=All

TypeError: Argument 1 passed to Drupal\Core\Render\Renderer::doTrustedCallback() must be callable, array given, called in /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php on line 786 en Drupal\Core\Render\Renderer->doTrustedCallback() (línea 51 de /var/www/html/c19052021/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php)#0 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(786): Drupal\Core\Render\Renderer->doTrustedCallback() #1 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(377): Drupal\Core\Render\Renderer->doCallback() #2 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender() #3 /var/www/html/c19052021/core/lib/Drupal/Core/Template/TwigExtension.php(450): Drupal\Core\Render\Renderer->render() #4 /var/www/html/c19052021/sites/default/files/php/twig/60a69e500d7a6_block--system-messages-bl_02i4T0QXD46gPchI_FrCLTJYY/zTiZxVKy59gZ7SJQA8M33zY1HUhrYbRF5fyB88pkFAU.php(39): Drupal\Core\Template\TwigExtension->escapeFilter() #5 /var/www/html/c19052021/vendor/twig/twig/src/Template.php(405): __TwigTemplate_2cbc405d2bb73734a2fa4a8e809868a1fae9ba2d0dca061fe2385c936668cdec->doDisplay() #6 /var/www/html/c19052021/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling() #7 /var/www/html/c19052021/vendor/twig/twig/src/Template.php(390): Twig\Template->display() #8 /var/www/html/c19052021/core/themes/engines/twig/twig.engine(65): Twig\Template->render() #9 /var/www/html/c19052021/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template() #10 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(436): Drupal\Core\Theme\ThemeManager->render() #11 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(449): Drupal\Core\Render\Renderer->doRender() #12 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender() #13 /var/www/html/c19052021/core/lib/Drupal/Core/Template/TwigExtension.php(450): Drupal\Core\Render\Renderer->render() #14 /var/www/html/c19052021/sites/default/files/php/twig/60a69e500d7a6_page.html.twig_Lbj7ZVb9WIS6O94uP7x8nsWqY/2cmgnwxDP3Z3wI-rHDBIoQ2KSsRzgo2VLFlS0X1zecY.php(124): Drupal\Core\Template\TwigExtension->escapeFilter() #15 /var/www/html/c19052021/vendor/twig/twig/src/Template.php(405): TwigTemplate_4dd58ecc6cd9c9a6fa67f1a9be3344dccd44ac50e683fa410411009a42a3ed62->doDisplay() #16 /var/www/html/c19052021/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling() #17 /var/www/html/c19052021/vendor/twig/twig/src/Template.php(390): Twig\Template->display() #18 /var/www/html/c19052021/core/themes/engines/twig/twig.engine(65): Twig\Template->render() #19 /var/www/html/c19052021/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template() #20 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(436): Drupal\Core\Theme\ThemeManager->render() #21 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender() #22 /var/www/html/c19052021/core/lib/Drupal/Core/Template/TwigExtension.php(450): Drupal\Core\Render\Renderer->render() #23 /var/www/html/c19052021/sites/default/files/php/twig/60a69e500d7a6_html.html.twig_eBZHnJttLNoUXBYaCaxi5uGNj/5pkiZtgF_IBGYmr3pBFHae3Te7bEBB3nbzi6PD0zT7I.php(93): Drupal\Core\Template\TwigExtension->escapeFilter() #24 /var/www/html/c19052021/vendor/twig/twig/src/Template.php(405): TwigTemplate_7c36c870f05cac2210e123f8bb58b37b2a4a3e02266adfaf4c4984a3cf27969a->doDisplay() #25 /var/www/html/c19052021/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling() #26 /var/www/html/c19052021/vendor/twig/twig/src/Template.php(390): Twig\Template->display() #27 /var/www/html/c19052021/core/themes/engines/twig/twig.engine(65): Twig\Template->render() #28 /var/www/html/c19052021/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template() #29 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(436): Drupal\Core\Theme\ThemeManager->render() #30 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender() #31 /var/www/html/c19052021/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(162): Drupal\Core\Render\Renderer->render() #32 /var/www/html/c19052021/core/lib/Drupal/Core/Render/Renderer.php(578): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent{closure}() #33 /var/www/html/c19052021/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(163): Drupal\Core\Render\Renderer->executeInRenderContext() #34 /var/www/html/c19052021/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() #35 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() #36 /var/www/html/c19052021/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func() #37 /var/www/html/c19052021/vendor/symfony/http-kernel/HttpKernel.php(163): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() #38 /var/www/html/c19052021/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #39 /var/www/html/c19052021/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle() #40 /var/www/html/c19052021/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle() #41 /var/www/html/c19052021/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle() #42 /var/www/html/c19052021/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass() #43 /var/www/html/c19052021/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle() #44 /var/www/html/c19052021/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() #45 /var/www/html/c19052021/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() #46 /var/www/html/c19052021/core/lib/Drupal/Core/DrupalKernel.php(716): Stack\StackedHttpKernel->handle() #47 /var/www/html/c19052021/index.php(19): Drupal\Core\DrupalKernel->handle() #48 {main}.

any help? Thanks.

CangurinLimpiezasZaragoza commented 3 years ago

finally works me with manual installation :)

TobiasKulvik commented 2 years ago

Ok. I think I figured out the starting point. I was running this in a Linux environment, which defaults to dash instead of bash. By calling bash ~/build.sh instead of sh ~/build.sh, the script completed, with some errors. I’m including those below. I haven’t yet taken the theme for a spin, but I can confirm that the files were renamed, etc, so hoping to report some good news after further testing.

sed: can't read : No such file or directory
sed: can't read : No such file or directory
sed: -e expression #1, char 1: unknown command: `.'
sed: -e expression #1, char 1: unknown command: `.'
rm: cannot remove '*.bak': No such file or directory

I had the same problem. I removed the extra space -i and .bak and it worked.

Before

sed -i .bak 's/package: Core/core_version_requirement: ^9/g' *.info.yml
sed -i .bak 's/experimental: true//g' *.info.yml

After

sed -i.bak 's/package: Core/core_version_requirement: ^9/g' *.info.yml
sed -i.bak 's/experimental: true//g' *.info.yml

This really worked! Thx

Amannim commented 1 year ago

This problem occurs because of a mismatch in naming of the (themename)PreRender.php and more importantly, the class within.

So if you used mycustom, the file and class needs to be: web/themes/custom/mycustom/src/mycustomPreRender.php and mycustomPreRender respectively.

Ideally the filename should start with a capital M, the class name would match.

web/themes/custom/mycustom/mycustom.theme also has references to mycustomPreRender::class and "use Drupal\mycustom\mycustomPreRender;" at the top.

Using the capital letter causes a problem because somewhere else in the theme, it dynamically builds the classname using the lowercase version which causes the problem above.

Anyone know where the dynamic class references are? Would love to make this proper. I'll keep poking around, but happy to finally have a clone of Olivero so I can progress with development.