Cannot find modules '/app/mysqld'

patkelvin22
TRIAL

8 months ago

I'm pretty new to all of this. I've tried for hours to find a solution. I really need help please.
```
node:internal/modules/cjs/loader:1143
throw err;

at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)

code: 'MODULENOTFOUND',
}

Node.js v18.20.5
node:internal/modules/cjs/loader:1143
throw err;
^

Error: Cannot find module '/app/mysqld'
at Module.resolveFilename (node:internal/modules/cjs/loader:1140:15) at Module.load (node:internal/modules/cjs/loader:981:27)
at Function.executeUserEntryPoint as runMain
at node:internal/main/runmainmodule:28:49 {
code: 'MODULENOTFOUND',
requireStack: []
}

Node.js v18.20.5
Deploy crashed
``

Solved

0 Replies

patkelvin22
TRIAL

8 months ago

1ccc0491-1cd6-441e-a3c1-05211feeca8b


8 months ago

why do you have a mysql daemon in your NodeJS application?
If you're trying to use a MySQL database then you can just deploy one into your Railway project

1314544277014970400


patkelvin22
TRIAL

8 months ago

I created a new project using my github repo (a5886754-0e45-4ccd-83df-a4b57ca5ecaa).
I added MySQL service. I try to copy the variables in my .env. Idk why the HOST is railway.internal instead of something that finishes with .railway.app


patkelvin22
TRIAL

8 months ago

i already have a local database called "maville" that i'm trying to deploy


patkelvin22
TRIAL

8 months ago

i dont even know if i'm making sense


patkelvin22
TRIAL

8 months ago

@Fragly could you please help me?


8 months ago

Please don't ping conductors


8 months ago

You are not. Can you please explain what you're trying to do? Are you trying to copy your service env variables into your local environment? If so, do not use the internal URL, you will need to use your database's public URL


patkelvin22
TRIAL

8 months ago

I created a database and i read that i could use railway to deploy it and make it public. I thought i had to add my add my github repository and then add MySQL


patkelvin22
TRIAL

8 months ago

sorry for the ping


8 months ago

You can, that's exactly what you have to do. Folow what Fragly said above, add a database to your project then copy the environment variables into your app


8 months ago

Make sure to reference the environment variables rather than commit the secrets to Github


patkelvin22
TRIAL

8 months ago

is my .env correct?
MYSQLHOST=localhost MYSQLUSER=root
MYSQLPASSWORD= MYSQLDATABASE=maville
MYSQL_PORT=3306
PORT=8080


8 months ago

Looks fine to me, but only you can see your env variables


8 months ago

If they match, that's good


8 months ago

Actually, MYSQL_PORT should be the public URL port on your database. Make sure those match


patkelvin22
TRIAL

8 months ago

how do i get my public URL port. sorry i'm really new to this…


8 months ago

1314738906285080600


8 months ago

Example from one of my services


patkelvin22
TRIAL

8 months ago

ah okay


8 months ago

Your public networking URL should be used locally, internal URL should be used internally


patkelvin22
TRIAL

8 months ago

still doesn't work idk what i'm doing wrong. I copied the env variables from railway and added them in my .env. I get this :

pattyboi22@MacBookAir MaVilleAPI % node index.js
Serveur API démarré sur http://localhost:8080
Erreur de connexion à la base de données : Error: getaddrinfo ENOTFOUND mysql.railway.internal
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'mysql.railway.internal',
  fatal: true
}

1314742322516459500


patkelvin22
TRIAL

8 months ago

it works now i had to change the host to the public network one . The problem is i can't find my API public url


8 months ago

Your api won’t have one by default, you’ll have to generate one in the service settings



8 months ago

!s


Status changed to Solved adam 8 months ago


Cannot find modules '/app/mysqld' - Railway Help Station