flyntwp / flynt

Component based WordPress starter theme, powered by ACF Pro and Timber, optimized for a11y and fast page load results.
https://flyntwp.com
MIT License
735 stars 84 forks source link

Build Fails #518

Closed oppenheimer- closed 1 year ago

oppenheimer- commented 1 year ago

I can successfully "npm start", but "npm run build" fails.

I'm on windows / cmd / with node 19.6.0

there were a lot of problems in found php files:

FILE: D:\machen\html\wordpress\flynt\single.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but
   |       |     found "\r\n"
   |       |     (Generic.Files.LineEndings.InvalidEOLChar)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

After some research, I had to tweak "phpcs.xml.dist" and added:

<rule ref="./phpcs.xml.dist">
  <exclude name="Generic.Files.LineEndings"/>
</rule>

But now there are memory problems

D:\machen\html\wordpress\flynt>npm run build

> flynt@2.0.1 build
> run-s --silent checkVersion lint build:production

node: 19.6.0
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in D:\machen\html\wordpress\flynt\vendor\squizlabs\php_codesniffer\src\Ruleset.php on line 848

The PHP_CodeSniffer "phpcs" command ran out of memory.
Either raise the "memory_limit" of PHP in the php.ini file or raise the memory limit at runtime
using `phpcs -d memory_limit=512M` (replace 512M with the desired memory limit).

i tried to raise that in the file without much success, though

<ini name="memory_limit" value="512M"/>

raising the memory in the php.ini to 1025M didn't help either.

domtra commented 1 year ago

Hi @oppenheimer- , unfortunately I am not that familiar with windows. Maybe @timohubois can help out? But you seem to have fixed the line ending issue anyways. The memory issue could either be fixed by adjusting you global php.ini for the cli, or adjust the line in the package.json to be

"lint:php": "cross-env ./vendor/bin/phpcs",

Otherwise you could also disable linting to see if building actually works.

This can be done by either adjusting the package.json to

"build": "run-s --silent checkVersion lint build:production",

or running npm run build:production.

oppenheimer- commented 1 year ago

thanks for the quick answer @domtra i tried to raise the memory to 1024M, but that errored out as well.

Not sure what i should change in that specific line as it is a fresh install.

"lint:php": "cross-env ./vendor/bin/phpcs",

npm run build:production works like a charm though. could it be the linter overflowing?

anways, i'm glad it works now and looking forward trying flynt more now! thanks for work guys! 😎

domtra commented 1 year ago

hey, glad it worked. i totally did not adjust the lines I sent you over. this is what I meant.

"lint:php": "cross-env ./vendor/bin/phpcs -d memory_limit=512M",

and

"build": "run-s --silent checkVersion build:production",