The team is now working on the WordPress Interactivity API. This unblocks the same UX Frontity framework enabled but directly in WordPress Core, fully compatible with the new Site Editor.
Does the Error: Cannot read property 'flags' of undefined have a stacktrace? Could you provide it? It should point us to the problem.
Every single google search result on the first page points with for āError: Cannot read property āflagsā of undefinedā seems to point to a typescript or angular issue like this one or that one. Are you using TS in the project and are you sure that itās not a TS issue?
An internal param called flags is used by one of the libraries we use in the CLI, commander so I guess the problem may be there. Iām going to investigate.
luisherranz10
Iāve just started a fresh project on Windows 10 and it works fine.
Things you can try:
Search for ".flags" in your code. Make sure the error is not in your code.
Run npx frontity dev -p and check if you see any error in your code that only happens in production mode.
Try with both npm run dev or npx frontity dev to see if it makes a difference.
If the problem persists, check the version of commander with:
npm ls | find "commander"
I am running 2.20.3 here and it works fine here in Windows 10.
modyydom11
I found the cause of the problem
it is due to importing react-slick
I found also this behavior
The site is WORKING well in these situations:
On Zeit now server
With npx frontity dev
With npx frontity dev -p
When running npx frontity serve AFTER npx frontity dev
The site is NOT working in these situations:
When running npx frontity serve AFTER npx frontity build
When running npx frontity serve AFTER npx frontity dev -p
I donāt know what in zeit now that makes it working that is not in the npx frontity build
Iām sorry again for being so late and I really thankful of your efforts in helping me
luisherranz12
Thanks @modyydom, I was able to reproduce the issue. The problem is caused by the TypeScript compiler interacting with react-slick in production mode.
I am not sure about the reason, but itās not a good idea to run the TypeScript compiler on frontity serve, so I have filed a bug to get rid of that: https://github.com/frontity/frontity/issues/355
Until we fix that issue, you can create a file that does the require itself and run that, like this:
please fix this problem
i can not deploy this on Now.
SantosGuillamot19
Hi @prainua, thanks a lot for the feedback and sorry for the inconvenience this may have caused Weāve just bumped up the priority of this bug and it should be addressed in the coming weeks. Weāll keep track of it at the GitHub issue.
Hey @juanma. I am also facing this issue and I am totally stuck. I cant even figure out how to start debugging it.
npx frontity build completes without issue npx frontity serve fails with the following message:
donkokoć: ~/devs/JS/kh-frontity-theme [git:live]
$ npx frontity serve
Error: Cannot read property 'flags' of undefined
If you need help please visit /.
Happens to me also on the live server, that is how I found the issue. I have made a github action that uses ssh to connect to server, pull from github, build the app and run npx frontity serve but it fails in the last step because of this error.
I have done all of this multiple times, unfortunatelly that didnāt bring me further. I also saw the other posts mentioning the same issue and they both have very different causes, thatās why I was wondering if I can somehow log more information or see the full stack.
I can provide a github repo, but its private. Can you give me your github user and I can add you?
juanma31
Hi @ni.bonev,
Unfortunately we donāt provide support to private repositories.
Could you replicate your issue (only the portion of the code that provokes the issue) in a public repository (or codesandbox) so any member of the community (Frontity team included) can help you with your issue?
1 Like
mmczaplinski34
Hi @ni.bonev !
Could you run npx frontity info (Iād like to see if you are using any packages that might be causing this issue and what version of node youāre on)
mmczaplinski35
Also, just to let you know: This is unfortunately an issue with one of frontityās dependencies and not with frontity itself.
It doesnāt, of course, mean that itās less important, just that we might have less ability to fix it and to fix it quickly - sorry about this!
2 Likes
ni.bonev36
Hey @mmczaplinski,
thank you so much for coming back to me about this. I was already getting to start desperate.
Just to say a few things, also referring to @juanmaās answer.
I completely understand the situation and I donāt expect you guys to debug/fix my issue. It is however something that was suggested so I wanted to offer access to my repository.
This aside, all I wanted was to get some help with debugging this and getting to the bottom of it, as I am completely clueless how to find the issue in a situation where the error is so vague. I would love to find the solution, just some directions are needed