#create-remix is looking for /src/main.tsx

1 messages · Page 1 of 1 (latest)

pastel cipher
#

I just created a new remix project following the suggested documentation

npx create-remix@latest <dir>

However when I try to run the dev environment npm run dev and open it up in the browser, i get an exception thrown about not finding a /src/main.tsx file.

I haven't touched the code inside the generated dir yet, was just going to see it run first but am stuck on this issue. any help would be appreciated!

upper wren
#

can i see your vite.config.ts

pastel cipher
#
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

declare module "@remix-run/node" {
  interface Future {
    v3_singleFetch: true;
  }
}

export default defineConfig({
  plugins: [
    remix({
      future: {
        v3_fetcherPersist: true,
        v3_relativeSplatPath: true,
        v3_throwAbortReason: true,
        v3_singleFetch: true,
        v3_lazyRouteDiscovery: true,
      },
    }),
    tsconfigPaths(),
  ],
});
upper wren
#

you just need to move the remix() plugin to be the last item in the plugins array.

pastel cipher
#

hmmm still the same set of errors thrown after moving remix to the end of the plugins array. is there some cache or something i need to blow away?

upper wren
#

let's try that

#

remove node modules and the likes

#

or maybe you are loading this to the browser <script type="module" src="/src/main.tsx"></script>.

pastel cipher
#

the html file does have this script tag. where is that being generated?

upper wren
#

let me see the tag

pastel cipher
#

the root.tsx file (which is what I'm assuming is where this is coming from, due to not seeing an actual .html file in the project) looks like this

  Links,
  Meta,
  Outlet,
  Scripts,
  ScrollRestoration,
} from "@remix-run/react";
import type { LinksFunction } from "@remix-run/node";

import "./tailwind.css";

export const links: LinksFunction = () => [
  { rel: "preconnect", href: "https://fonts.googleapis.com" },
  {
    rel: "preconnect",
    href: "https://fonts.gstatic.com",
    crossOrigin: "anonymous",
  },
  {
    rel: "stylesheet",
    href: "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",
  },
];

export function Layout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        <meta charSet="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <Meta />
        <Links />
      </head>
      <body>
        {children}
        <ScrollRestoration />
        <Scripts />
      </body>
    </html>
  );
}

export default function App() {
  return <Outlet />;
}
#

heres the script tag thats blowing up in the DOM

upper wren
#

Your root.tsx is correct for Remix and does not generate a <script src="/src/main.tsx"> tag. The request for /src/main.tsx suggests the project may have been scaffolded with the wrong template or has a misconfiguration in the Vite or package script

pastel cipher
#

Ok, so I didn't specify a template. which would mean its using the Remix App Server correct?

#

everything is boilerplate, installed from the CLI. Haven't made any changes just tried to run it. So im curious how I should look into where the misconfiguration is coming from

upper wren
#

yes

#

you are correct

pastel cipher
#

Steps to reproduce if you'd like to try on your end.

npx create-remix@latest test-dir
cd test-dir
npm run dev
upper wren
#

alright

#

so you are good now?

pastel cipher
#

Sorry let me explain better, the issue is still happening, and it is something that is being generated by the CLI. When i do the above steps (i.e. make a new remix application via the create-remix CLI), make no changes to the code but just run dev to see the boilerplate landing page... It throws that error and is a blank white screen. Does that help explain the context of the issue?

upper wren
#

oops

#

to not waste more time, we should try using the Vite template explicitly

#

npx create-remix@latest --template remix-run/remix/templates/vite my-vite-remix-app
cd my-vite-remix-app
npm install
npm run dev

#

follow this

pastel cipher
#

ok ill give it a shot and report back! thanks

upper wren
#

alright, i will be here expecting, (might take a little longer but i will surely respond)

pastel cipher
#

it cant find the template Oh no! The path "templates/vite" was not found in this GitHub repo.

upper wren
#

Are you still here?

pastel cipher
#

Yes

upper wren
#

let create a new app, i will guide you.

pastel cipher
#

Ok I'm ready

upper wren
#

npx create-remix@latest my-remix-app

#

do this

pastel cipher
#

done

upper wren
#

afrer that, navigate to your project

#

then npm install

#

npm run dev

pastel cipher
#

done. and its throwing the same error

upper wren
#

hehe

#

in a new terminal entirely

#

not that same project directory

#

my-remix-app/
├── app/
│ ├── routes/
│ │ └── _index.tsx # Home page
│ ├── root.tsx # Root component
│ └── entry.client.tsx # Client entry point
├── public/ # Static assets
├── package.json
└── remix.config.js # Remix configuration

#

you should have something like this

pastel cipher
#

just to confirm before i do this im using node v22.17.0. should i change it to a different version?

upper wren
#

it's okay

#

just close and delete all those one's not working

#

start afresh,

#

npx create-remix@latest my-remix-app(your project name)

pastel cipher
#

just to be sure i stopped all processies, closed out the terminal. blew away any projects created before. and made a new one. the same issue is happening. here is the full terminal log from start to finish

upper wren
#

hmmn

#

i am thinking of a faster solution

pastel cipher
#

oh interesting the app structure is different

upper wren
#

opened the folder first

#

let'see

#

also, since it's working here

#

i can create it here and zip to you

#

what do you think

pastel cipher
#

sure thats fine with me 🙂

#

the folder structure is essentially the same but it has some tailwind files and an entry.server.tsx as well. not sure if thats helpful information or not

#

also no remix.config file

upper wren
#

it works here

#

will send the zip file soon

#

see mine

#

still here?

pastel cipher
#

yep

#

and yes your folder structure looks the same as mine

upper wren
#

lmao

#

please drop your mail

#

i actually zippped the node modules too

#

to avaoid anything

#

On it

#

sent t.

#

kindly check through and install

#

seen?

pastel cipher
#

yes, theres a file permissions issue on the executable, trying to resolve that right now

upper wren
#

how is it going?

#

i made the link free by the way

pastel cipher
#

this is so weird, the same error message is coming up again

#

on the project you shared, with no changes done to it except the chmod on /node_modules/.bin/remix

upper wren
#

hehe

#

tired already

#

delete nodemoudles

#

stop the server'

#

npm run dev

pastel cipher
#

im so confused why thats failing. However i can still do a prod build and run the server. I can just stick with that since this seems to be some weird issue with my machine and or the packages its pulling in

#

if you dont mind, could you share the node version and npm version you are using? maybe switching to the same version will work

upper wren
#

okay

pastel cipher
#

if its not that maybe looking to see if theres any os updates or something will help

upper wren
#

v20.19.3

#

try to update your node

#

need to go, hopefully you get it sort out by updating your node

#

i use windows

pastel cipher
#

thank you for your help! sorry it wasnt an easy fix 🙂

upper wren
#

How were you able to get it solveddd?

upper wren
#

😀

pastel cipher
#

sorry i had a take home test with a deadline and needed to work on the task instead of the dev env. I'll poke around at it again this evening