Cannot find modules '/app/mysqld'
patkelvin22
TRIALOP

a year 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

26 Replies

patkelvin22
TRIALOP

a year ago

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


a year 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
TRIALOP

a year 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
TRIALOP

a year ago

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


patkelvin22
TRIALOP

a year ago

i dont even know if i'm making sense


patkelvin22
TRIALOP

a year ago

@Fragly could you please help me?


a year ago

Please don't ping conductors


a year 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
TRIALOP

a year 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
TRIALOP

a year ago

sorry for the ping


a year 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


a year ago

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


patkelvin22
TRIALOP

a year ago

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


a year ago

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


a year ago

If they match, that's good


a year ago

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


patkelvin22
TRIALOP

a year ago

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


a year ago

1314738906285080600


a year ago

Example from one of my services


patkelvin22
TRIALOP

a year ago

ah okay


a year ago

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


patkelvin22
TRIALOP

a year 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
TRIALOP

a year 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


a year ago

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



a year ago

!s


Status changed to Solved adam over 1 year ago


Loading...