patternlab-node: Installing Twig Engine on new project causes errors on npm run patternlab build
I am using Patternlab edition-node@1.0.0-alpha.13 on Windows, with Node 9.9.0, using a Vanilla Edition.
Expected Behavior
npm run patternlab build turns .twig files into public twig patterns without error
Actual Behavior
Seems like for each pattern you get:
(node:11932) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
and then
{ Error: Command failed: php C:\websites\fail3\node_modules\exec-php\lib\php\cli.php -pC:\Users\RYANBO~1\AppData\Local\Temp\tmp-11932tjn5me1.m9qf.tmp -rC:\Users\RYANBO~1\AppData\Local\Temp\tmp-11932tus7wsp.18ge.tmp
PHP Fatal error: Uncaught Twig_Error_Loader: The "..\..\..\..\source\_patterns" directory does not exist ("C:\websites\fail3\node_modules\node-twig\php\..\..\..\..\source\_patterns"). in C:\websites\fail3\node_modules\node-twig\php\vendor\twig\twig\lib\Twig\Loader\Filesystem.php:101
Stack trace:
#0 C:\websites\fail3\node_modules\node-twig\php\vendor\twig\twig\lib\Twig\Loader\Filesystem.php(82): Twig_Loader_Filesystem->addPath('..\\..\\..\\..\\sou...', '__main__')
#1 C:\websites\fail3\node_modules\node-twig\php\vendor\twig\twig\lib\Twig\Loader\Filesystem.php(40): Twig_Loader_Filesystem->setPaths(Array)
#2 C:\websites\fail3\node_modules\node-twig\php\Twig.php(80): Twig_Loader_Filesystem->__construct('..\\..\\..\\..\\sou...')
#3 C:\websites\fail3\node_modules\exec-php\lib\php\functions.php(28): render('02-pages\\00-gen...', Array)
#4 C:\websites\fail3\node_modules\exec-php\lib\php\cli.php(14): _exec_php_call_user_function('C:\\websites\\fai...', 'render', Array)
#5 {main}
thrown in C:\websites\fail3\node_modules\node-twig\php\vendor\twig\twig\lib\Twig\Loader\Filesystem.php on line 101
at ChildProcess.exithandler (child_process.js:273:12)
at ChildProcess.emit (events.js:180:13)
at maybeClose (internal/child_process.js:936:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
killed: false,
code: 255,
signal: null,
cmd: 'php C:\\websites\\fail3\\node_modules\\exec-php\\lib\\php\\cli.php -pC:\\Users\\RYANBO~1\\AppData\\Local\\Temp\\tmp-11932tjn5me1.m9qf.tmp -rC:\\Users\\RYANBO~1\\AppData\\Local\\Temp\\tmp-11932tus7wsp.18ge.tmp' }
undefined
sidenote this happens on the initial npm run patternlab build. If you run it after the error, it says patternlab → build: Yay, your Pattern Lab project was successfully built ☺ but the patterns within public still show only the text “undefined”. Example location public/patterns/00-test-00-testpattern/00-test-00-testpattern.markup-only.html
Steps to Reproduce
*In Windows, go to a blank folder via cmd
*Run npm init -y && npx @pattern-lab/cli -c patternlab init (this issue works through how you can even do that if you have npx/npm cache issues)
*Since the starterkit doesn’t allow you to choose an engine… run npm install @pattern-lab/engine-twig
*Edit your package.json and include "patternlab": "patternlab" within the scripts section
*Create a twig pattern
*Create a folder within source called fonts since the build looks for that. (I may submit another issue around that)
*Run npm run patternlab build
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 18 (13 by maintainers)
Got a bit deeper the rabbit hole: https://github.com/pattern-lab/patternlab-node/blob/543558a692d4db04b7d29f11f940cfd67ae25a6a/packages/core/src/lib/ui_builder.js#L801-L802 is
undefinedas therendermethod calls do not return anything.node-twigis not used by many and was not updated for two years now.twig,twingor other alternatives may be much better and work.Currently the Twig engine of the Node edition can not be used due to the current issues.