Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
Node.js Cannot find package imported from

I have a problem with deploying my project onto server, on my pc everything works fine and there is no imports problems. Thank you for ur help!

Error Message:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/igor/backend/alina_edu/router/articleRoutes.js' imported from /home/igor/backend/alina_edu/index.js
    at new NodeError (internal/errors.js:322:7)
    at finalizeResolution (internal/modules/esm/resolve.js:318:11)
    at moduleResolve (internal/modules/esm/resolve.js:776:10)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:887:11)
    at Loader.resolve (internal/modules/esm/loader.js:89:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:76:40)
    at link (internal/modules/esm/module_job.js:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Imports from index.js:

import courseRoutes from "./router/CourseRoutes.js";
import authRoutes from './router/authRoutes.js';
import articleRoutes from './router/articleRoutes.js';
import tagsRouter from "./router/TagsRouter.js";
import testsRoutes from "./router/TestsRoutes.js";

Package.json module annotation

  "main": "index.js",
  "type": "module",

ArticleRoutes.js itself

import {Router} from "express";
import ArticleController from "../controllers/ArticleController.js";
const articleRoutes = new Router();

// ...blah-blah-blah...

export default articleRoutes;

Server settings:

  • Ubuntu 20.04
  • Node.js v16.16.0
  • NPM v8.16.0
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Are you developing on a Windows machine and deploying to an Ubuntu machine?

CAPS

Your files have capital letters in them (e.g. CourseRoutes.js), which Windows ignores. Filenames in Windows are case-insensitive, but case-sensitive in Ubuntu, so if the upper/lowercase, it will work on Windows but fail in Ubuntu.

verification

If you're using source control, check the case of the filenames in the web interface (e.g. GitHub) or by cloning a new repo. If you aren't using source control, use source control.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!