MERN deployment issues

Hi, this my first post here and I first deployment with Render!

Have got some issues …
my pnpm install seems to work great but during my pnpm build I’ve got this into my logs :slightly_frowning_face:

==> Running build command 'pnpm i && pnpm build'...
.../bcrypt@5.1.1/node_modules/bcrypt install$ node-pre-gyp install --fallback-to-build
.../bcrypt@5.1.1/node_modules/bcrypt install: [bcrypt] Success: "/opt/render/project/src/backend/node_modules/.pnpm/bcrypt@5.1.1/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" is installed via remote
.../bcrypt@5.1.1/node_modules/bcrypt install: Done
dependencies:
+ bcrypt 5.1.1
+ concurrently 8.2.2
+ cookie-parser 1.4.6
+ cors 2.8.5
+ dotenv 16.4.5
+ express 4.19.2
+ express-validator 7.1.0
+ jsonwebtoken 9.0.2
+ mongoose 8.4.0
+ morgan 1.10.0
+ openai 4.47.1
devDependencies:
+ @types/bcrypt 5.0.2
+ @types/cookie-parser 1.4.7
+ @types/cors 2.8.17
+ @types/express 4.17.21
+ @types/jsonwebtoken 9.0.6
+ @types/node 20.12.12
+ nodemon 3.1.1
+ ts-node 10.9.2
+ typescript 5.4.5
Done in 6.9s
> backend@1.0.0 build /opt/render/project/src/backend
> tsc
src/routes/chatRoutes.ts(5,8): error TS2307: Cannot find module '../controllers/chatControllers.js' or its corresponding type declarations.
 ELIFECYCLE  Command failed with exit code 2.
==> Build failed 😞

Hi there,

This is a code issue and nothing specific to MERN.

The error shows the problem is in src/routes/chatRoutes.ts and specifically the import of ../controllers/chatControllers.js - it would be worth checking the casing of the import you’re using to make sure it exactly matches the file on disk and fix either the import casing or the file/folder path in your repo.

Regards,

Thanks for your reply @John_B. :pray:

I’ve seen this is an import path issue.

But everything is working find in local with pnpm start or pnpm dev, no import path issues …

my tsconfig.json is:

{
  "compilerOptions": {
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "target": "ES2022",
    "sourceMap": true,
    "outDir": "dist",
    "allowSyntheticDefaultImports": true
  },
  "include": ["src/**/*", "src/index"]
}

I understand that when it build on Render, it is looking for a ../controllers/chatControllers.js in my src/... folder but it is a .ts because it is before the compilation.

I’m stuck :upside_down_face:

What operating system are you using locally?

Also, to be clear, we do nothing specific to rendering here; we simply run the build and start command that you configure.

mac

This happened to me too, on my windows machine it worked perfectly fine, but when i put it in a Linux VM for testing, it didn’t, probably related to how different operating systems handle file name casing

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