Differences between code generated using create-refine-app through yarn vs through npm
Hey all, just started learning about Refine today and went to start the tutorial using the headless version. I initially generated the Refine project using yarn as package manager. The project was created successfully, but when I went to go look at the generated App.tsx I saw that it was poorly formatted with lots of whitespace and unused imports. I tried installing Refine through npm instead and the code generated looked much better. Please see the attached screenshot - the yarn version is on the left and the npm version is on the right.
Is the yarn installer working with an older version of the boilerplate? What accounts for the difference?
10 Replies
Hi @unwrong. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, the tutorial you mentioned suggests using the following command to create a new project with yarn:
Please note that it only supports yarn@1 version (source (https://refine.dev/docs/tutorial/getting-started/headless/create-project)).
If you still encounter issues with the generated code, I recommend checking the Refine documentation (https://refine.dev/docs) and Refine blog (https://refine.dev/blog) for more information.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------Overview | refine
What is refine?
Blog | refine
A Docusaurus powered blog!
<@706871839145590905> kapa.ai is still learning and improving, please let us how it did by reacting below
sensitive-blue•2y ago
it's not expected behavior. Thank you for the issue report. We will investigate the issue
deep-jadeOP•2y ago
Awesome, thanks for the speedy response.
If it helps at all, I used exactly the commands suggested on the tutorial page:
yarn create refine-app -- -o refine-headless tutorial
and
npm create refine-app@latest -- -o refine-headless tutorial
with the only difference being that I called my project folders something different.
sensitive-blue•2y ago
When you add latest to yarn. is it good ?
deep-jadeOP•2y ago
I'll try now.
I tried:
yarn create refine-app@latest -- -o refine-headless tutorial
and got an error saying that ".yarn/bin/create-refine-app@latest" could not be found.
Is there an alternate command in yarn to specify the latest version?
sensitive-blue•2y ago
I don't know. We will look into it tomorrow. its getting late where i live 🥹
Meanwhile please use npm. After that you can manually migrate to yarn ofc
deep-jadeOP•2y ago
Haha, for sure. Thanks for the help.
sensitive-blue•2y ago
Thanks for the bugreport