How to build a template from scratch?

The NextJS + TailwindCSS template is outdated (e.g. it uses NodeJS 16, when the latest version is NodeJS 21.7.1).

I tried to update NodeJS but then I get this error

nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines

       … while evaluating attribute 'REPLIT_LD_LIBRARY_PATH' of derivation 'nix-shell'

         at «string»:309:9:

          308|       {
          309|         REPLIT_LD_LIBRARY_PATH = (pkgs.lib.optionalString (env ? REPLIT_LD_LIBRARY_PATH) (env.REPLIT_LD_LIBRARY_PATH + ":")) +
             |         ^
          310|         pkgs.lib.makeLibraryPath deps;

       error: attribute 'nodejs-20_x' missing

       at /home/runner/aihypnosis/replit.nix:3:9:

            2|    deps = [
            3|         pkgs.nodejs-20_x
             |         ^
            4|         pkgs.nodePackages.typescript-language-server
       Did you mean one of nodejs-10_x, nodejs-12_x, nodejs-14_x, nodejs-16_x or nodejs-17_x?

I followed what I found in here and here. But I’m still getting the same error.

It’s all frustrating. So I thought about starting from scratch and building my own template (since my tech stack is always the same NextJS + TailwindCSS + shadcn/ui + MongoDB + Mongooose + Mailgun + Stripe)

But when I open a Blank Repl, even the package manager doesn’t exist

Sorry, packages are not configured for this Repl.
We are working on making more features configurable and packages available for more languages, check back again in the future.

Can someone please walk me through creating my own Template (using the latest versions of those packages)?

You might just have to wait then. You can make a Feature Requests topic if you want.

That’s not what I meant. The packages aren’t configured for a blank repl, but obviously there’s a way to configure them.

I just wondered how to do it? I want to build a template that uses the latest version of NextJS, Tailwind, NodeJS, etc…

1 Like

Hey @richardreeze!

I believe you would need to change the .replit file in a Repl. You can access this file by clicking the three dots in the Repl next to where it says Run > then click Show Hidden Files and finally click on the .replit file. Here is an example for NodeJS .replit code →

entrypoint = "index.js"
modules = ["nodejs-20:v8-20230920-bd784b9"]
hidden = [".config", "package-lock.json"]

[gitHubImport]
requiredFiles = [".replit", "replit.nix", "package.json", "package-lock.json"]

[nix]
channel = "stable-23_05"

[unitTest]
language = "nodejs"

[deployment]
run = ["node", "index.js"]
deploymentTarget = "cloudrun"
ignorePorts = false

You would have to find the other .replit lines by creating new premade Repls for each thing you want (Tailwind, NextJS, etc). If you really want to though, I code find them for you and compile the full .replit file. I hope this helps!

3 Likes

Thanks!

I didn’t understand this part though " You would have to find the other .replit lines by creating new premade Repls for each thing you want (Tailwind , NextJS , etc)"

I’m trying to create one premade Repl (so that I can use the template over and over again).

But when I open the Blank Repl (this one), it doesn’t even come with the package manager so I can’t install packages.

What am I missing?

1 Like

Sorry if I wasn’t clear, to make your own Repl with all the things you want, you need to copy over the .replit stuff from all of the other Repls (Next.js, Tailwind) and copy them into yours. Or you could install the packages in the Shell (this might be easier in the long run), you can find the commands in the docs of the things you want. I hope this helps!

2 Likes

Ahh got it! Thank you this is what I was looking for :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.