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.
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. - Remove
node_modules
andpackage-lock.json
, update all packages and donpm install
again. Follow this guide: https://docs.frontity.org/guides/keep-frontity-updated - Try with both
npm run dev
ornpx 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.
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
AFTERnpx frontity dev
The site is NOT working in these situations:
- When running
npx frontity serve
AFTERnpx frontity build
- When running
npx frontity serve
AFTERnpx 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
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:
const serve = require("@frontity/core/dist/src/scripts/serve").default;
serve({
isHttps: false,
port: 3000
});
You can take a look at this repo to see a full example:
Let me know if that solves your problem
Thatās Great
It is working perfectly
please fix this problem
i can not deploy this on Now.
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.
I still have a error. I updated to the latest version.
npx npm-check-updates -u
npm install
Hi @prainua
Did you try the solution provided above? ā Error: Did you forget to run "frontity build"?
If itās still not working, can you please provide the info suggested here?
The more info you provide about your issue the better. Providing a repo or code-sandbox with your code is especially helpful to find solutions of technical issues with specific code
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 https://community.frontity.org/.
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.
Hi @ni.bonev,
Can you check the following?
- You have Frontity core & packages updated to the latest versions ā https://docs.frontity.org/guides/keep-frontity-updated
- Youāre executing from the root of your project (from where there should be a
build
folder generated bynpx frontity build
)
In these are OK, can you please provide a repo or code-sandbox with your code? This is especially helpful to find solutions of technical issues with specific code
Hey @juanma,
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?
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?
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)
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!
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
Here is the output from npx frontity info
š§ $ npx frontity info
## System:
- OS: macOS 10.15
- CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
- Memory: 25.62 MB / 8.00 GB
- Shell: 5.0.18 - /usr/local/bin/bash
## Binaries:
- Node: 10.14.2 - /usr/local/bin/node
- npm: 6.14.8 - /usr/local/bin/npm
## Browsers:
- Chrome: 86.0.4240.75
- Edge: 86.0.622.38
- Firefox: 70.0
- Safari: 13.0.2
## npmPackages:
- @frontity/core: ^1.7.3 => 1.9.0
- @frontity/head-tags: ^1.0.5 => 1.0.7
- @frontity/html2react: ^1.3.5 => 1.4.0
- @frontity/koenighaus-theme: ./packages/koenighaus-theme => 1.4.2
- @frontity/tiny-router: ^1.2.1 => 1.2.1
- @frontity/wp-source: ^1.8.1 => 1.9.0
- @hookform/error-message: 0.0.4 => 0.0.4
- axios: ^0.19.2 => 0.19.2
- frontity: ^1.10.1 => 1.12.0
- frontity-contact-form-7: ^0.1.7 => 0.1.7
- js-cookie: ^2.2.1 => 2.2.1
- libphonenumber-js: ^1.7.57 => 1.8.2
- libphonenumber-js-core: 1.0.0
- libphonenumber-js-max: 1.0.0
- libphonenumber-js-min: 1.0.0
- libphonenumber-js-mobile: 1.0.0
- react-hook-form: ^6.4.1 => 6.8.6
- react-select: ^3.1.0 => 3.1.0
- react-spring: ^8.0.27 => 8.0.27
- woocommerce-shop: file:packages/woocommerce-shop => 1.0.0
## npmGlobalPackages:
- frontity: Not Found
- npx: Not Found
Hey @ni.bonev, could you please try using a āmanual serveā to see if the problem is in our npx frontity serve
command?
Something like this: https://github.com/luisherranz/frontity-react-slick/commit/86df2ad6b53db235f10230e953b410d8c8ba2f7a
Hey @luisherranz,
i tested this and the manual serve works on localhost. However I am not certain how it should work when deploying my app to my VPS? Which port do I need to use? Will that create some conflicts?
You can use any port you want, like when using npx frontity serve
. Just set it on the file.
Ok, thatās good news! It means the problem is on the CLI.
Could you please create a new project, with mars-theme for example, and slowly add all your npm packages, one by one, running npx frontity build && npx frontity serve
in between until you find the one that makes it fail?