Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm start resulting in PHP TwigRenderer Error #1175

Closed
kemiga opened this issue May 15, 2019 · 12 comments
Closed

npm start resulting in PHP TwigRenderer Error #1175

kemiga opened this issue May 15, 2019 · 12 comments
Assignees

Comments

@kemiga
Copy link

kemiga commented May 15, 2019

I'm setting up the Bolt design system for the first time on one machine running Ubuntu and another using Windows. On both machines, after running npm run setup then npm start, the process fails with the following error at the "Compiling Static Site" stage:

PHP TwigRenderer Error: The response callback is expected to resolve with an object implementing Psr\Http\Message\ResponseInterface, but rejected with "Error" instead.
Error: null
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bolt@0.0.0-development start: `cd docs-site && yarn run start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bolt@0.0.0-development start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/kleigh/.npm/_logs/2019-05-14T16_14_07_180Z-debug.log

@margoromo
Copy link
Contributor

Hello!

We received your note - I will have someone respond shortly. Thank you for notifying us.

-Margo Romanowski
Bolt Design System Product Owner

@sghoweri
Copy link
Contributor

sghoweri commented May 15, 2019

@kemiga we ran into the same issue recently (might be an upstream dependency problem) and ended up needing to lock down the version of the @bolt/twig-renderer composer.json file (in the packages/twig-renderer folder) to be 1.36.0 + re-run composer update.

At the moment our Travis CI builds seem to be checking out ok but this is still high on our radar to look further into + make sure everything is working as expected!

Out of curiosity, are you running the latest code that's up on master? Also, just wanted to double check: are you seeing this particular error message after (roughly) following the Developer Getting Started guide?

https://boltdesignsystem.com/docs/development/local-dev-environment-setup.html

@kemiga
Copy link
Author

kemiga commented May 16, 2019

@sghoweri yes cloned from master and have pulled the latest changes.

And yes I was following the getting started guide. npm run setup runs without issues and on running npm start everything builds/compiles fine until it starts compiling the static site.

The twig/twig version is set to 1.36.0 in the code I have checked out. I've tried re-running composer update in packages/twig-renderer but am still getting a 'PHP TwigRenderer Error'.

@AnthonySGeorge
Copy link

Hi, I've just done a fresh install and am having the same issue at the same point as kemiga.

@AnthonySGeorge
Copy link

Hi, this is still an issue for me in both the master and the 2.x branches

@adamszalapski
Copy link
Collaborator

adamszalapski commented Jun 3, 2019

@AnthonySGeorge you can try npm run clean and then composer clearcache make sure that all 'vendor' and 'node_modules' folders. After this try to run npm run setup and then npm start.

@Hubbz
Copy link

Hubbz commented Aug 15, 2019

@AnthonySGeorge I was having this issue too and just updating npm to the latest version worked for me.

@glassdimly
Copy link
Contributor

I'm getting this issue as well, here's a link to my composer.lock. I'm on master. https://github.com/boltdesignsystem/bolt/blob/master/docs-site/composer.lock#L283

Steps taken:

  • rm -rf docs-site/vendor && composer install
  • rm -rf node_modules && yarn install && yarn start

@glassdimly
Copy link
Contributor

Turned out this was because I was using node v12.13.0. Node v12.10.0 works fine.

@mariohernandez
Copy link

Are there any updates on this issue? I am experiencing the same error message when running npm run build or npm run watch (both gulp tasks). I have removed the node_modules folder and also package-lock.json but no luck. I even downgraded the node version to 12.10.0 as @glassdimly suggested. Here's my errors:
PHP TwigRenderer Error: The response callback is expected to resolve with an object implementing Psr\Http\Message\ResponseInterface, but rejected with "Error" instead.. I'd appreciate any tips or feedback to solve this issue.

@Tregonia
Copy link

Wanted to leave this here for anyone that may come to this error.

This error is thrown when the data being passed through embeds and twig structure, is being broken, and a template is receiving null.

The best solution is to check what variables are present in each template as you go down the line. If there are multiple errors like this in the stack, this will output multiple errors.

Example #1
Example #1 is the difference between these two examples. When the variable is null, or does not exist due to typo or misalignment of data, this error will be thrown.

{% include  '@themetheme/menu/menu.twig' with menu only %}

and

{% include  '@themetheme/menu/menu.twig' with main_menu only %}

Example #2
The second example is the difference between these examples. Because of the use of the only keyword, the site_footer variable was not passed, and is null is presented to the component. When the Twig include is executed as part of the layout.twig template, the data is not available.

{% embed '@theme/layout/layout.twig' with {
  "modifier": "footer",
  "site_footer": site_footer
} only %}
  {% block page_footer %}
   {% include '@theme/site-footer/site-footer.twig' with site_footer only %}
  {% endblock page_footer %}
{% endembed %}

and

{% embed '@theme/layout/layout.twig' with {
  "modifier": "footer",
} only %}
  {% block page_footer %}
   {% include '@theme/site-footer/site-footer.twig' with site_footer only %}
  {% endblock page_footer %}
{% endembed %}

@thamas
Copy link

thamas commented Jan 22, 2021

Thanks @Tregonia for the detailed info! ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests