Open tanmaythole opened 1 month ago
Hey @tanmaythole π
I just tried to reproduce this issue with the following steps:
yarn create redwood-app issue-reproduction
cd issue-reproduction
yarn redwood generate page home /
The generator command worked as expected and didn't error out in the way you see in your project.
I see from the environment information you are using node v18. Can you please upgrade to node v20 and try again to see if that fixes your issue? If not it would also be good to confirm what yarn why execa
produces.
Hey @Josh-Walker-GM
Thanks for the prompt reply. I have upgraded the node version to 20, but still no luck.
The output of yarn why execa
is:
ββ @commitlint/cli@npm:19.3.0
β ββ execa@npm:8.0.1 (via npm:^8.0.1)
β
ββ @commitlint/read@npm:19.2.1
β ββ execa@npm:8.0.1 (via npm:^8.0.1)
β
ββ @commitlint/rules@npm:19.0.3
β ββ execa@npm:8.0.1 (via npm:^8.0.1)
β
ββ @redwoodjs/cli-helpers@npm:7.7.3
β ββ execa@npm:5.1.1 (via npm:5.1.1)
β
ββ @redwoodjs/cli@npm:7.7.3
β ββ execa@npm:5.1.1 (via npm:5.1.1)
β
ββ default-gateway@npm:6.0.3
β ββ execa@npm:5.1.1 (via npm:^5.0.0)
β
ββ jest-changed-files@npm:29.7.0
β ββ execa@npm:5.1.1 (via npm:^5.0.0)
β
ββ lint-staged@npm:15.2.8
ββ execa@npm:8.0.1 (via npm:~8.0.1)
This issue occurs when I set up commit-lint for the project using yarn add -D @commitlint/cli @commitlint/config-conventional
. Otherwise, the generator command works as expected.
I'm not sure of the next steps here @tanmaythole. I did try reproducing by adding the same dependencies but didn't see the issue occur. I do believe that this is likely a real issue though and probably comes down to the fact we're on an older version of execa than other packages might be.
I'll ask the team if they have any suggestions on next steps here.
Hey @Josh-Walker-GM , I looked into the root cause of the issue and found that it occurs due to different versions of execa. In Redwood, version 5.1.1 is being used, which doesn't support ECMAScript modules. The issue arises after adding dependencies that require a newer version of execa, which does support ECMAScript modules.
To resolve this in Redwood, we can either update the execa version or check which version is being used and then act accordingly.
What's not working?
On executing
yarn redwood generate page home /
, I am getting errorError [ERR_REQUIRE_ESM]: require() of ES Module /<project-path>/node_modules/execa/index.js from /<project-path>/node_modules/@redwoodjs/internal/dist/generate/graphqlCodeGen.js not supported.
Stacktrace:
How do we reproduce the bug?
No response
What's your environment? (If it applies)
Are you interested in working on this?