You need to do read this prerequisite: Next.js Codebase Analysis <> create-next-app <> Create a local folder before you continue with this next steps.
Execute the local setup
When I copied a package into a new folder and executed the npm run build command. I ran into weird issues.
- Pnpm not found
I had to install pnpm.
- Missing typescript
Not sure why I got this error but I was able to resolve it using this link
- Boss fight — TS2353: Object literal may only specify known properties, and ‘retries’ does not exist in type ‘Options’.
Any typescript error is a video game boss fight to me. You get the joke!
I found few useful links listed below, but trying them did not magically fix the issue
- https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/60193
- https://stackoverflow.com/questions/64583681/object-literal-may-only-specify-known-properties-and-retries-does-not-exist-i
Let me know in the comments what you think about this issue.
But I ended up removing the retries altogether from the create-next-app.ts. Keep in mind Next.js has MIT License hence I made the bold move to make those changes and document them here in this article.
Once I removed the retries, the error was gone. I do not recommend doing this. There must be a good reason why the original authors have retries in place. I have removed it to understand the internal workings of create-next-app without spending a day or two just because I could not get retries options to be type safe.
You need to sometimes decide if the fix you are after is really worth it in the grand scheme of things.
This code ready for execution is available here
Execution
Change create-next-app to create-my-app and then run npx create-my-app.
Your playground is now ready for experiments.
Conclusion
I had to remove retries because of typescript error, I do not know how to fix it yet, my goal is to understand how create-next-app works and I would not worry much about an option that is about retrying. End outcome over temporary setback.
I am building a platform that explains best practices used in open source by elite programmers. Join the waitlist and I will send you the link to the tutorials once they are ready.
If you have any questions, feel free to reach out to me at ramu.narasinga@gmail.com
Get free courses inspired by the best practices used in open source.
About me:
Website: https://ramunarasinga.com/
Linkedin: https://www.linkedin.com/in/ramu-narasinga-189361128/
Github: https://github.com/Ramu-Narasinga
Email: ramu.narasinga@gmail.com
Top comments (0)