Cannot find modules '/app/mysqld'
patkelvin22
TRIALOP

2 years 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: 'MODULE_NOT_FOUND',
}

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] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.20.5
Deploy crashed
``
Solved

26 Replies

patkelvin22
TRIALOP

2 years ago

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


2 years 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

1314544277014970449


patkelvin22
TRIALOP

2 years 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

2 years ago

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


patkelvin22
TRIALOP

2 years ago

i dont even know if i'm making sense


patkelvin22
TRIALOP

2 years ago

@Fragly could you please help me?


2 years ago

Please don't ping conductors


2 years 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

2 years 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

2 years ago

sorry for the ping


2 years 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


2 years ago

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


patkelvin22
TRIALOP

2 years ago

is my .env correct?

MYSQL_HOST=localhost

MYSQL_USER=root

MYSQL_PASSWORD=

MYSQL_DATABASE=maville

MYSQL_PORT=3306

PORT=8080


2 years ago

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


2 years ago

If they match, that's good


2 years ago

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


patkelvin22
TRIALOP

2 years ago

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


2 years ago

1314738906285080576


2 years ago

Example from one of my services


patkelvin22
TRIALOP

2 years ago

ah okay


2 years ago

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


patkelvin22
TRIALOP

2 years 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
}

1314742322516459621


patkelvin22
TRIALOP

2 years 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


2 years ago

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



2 years ago

!s


Status changed to Solved adam over 1 year ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...