question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Docker build error: Cannot find module '/app/main'

See original GitHub issue

Environment

Windows 10 Enterprise

  • Hosting type

    • [] Form.io
    • Local deployment (Docker version 19.03.8, build afacb8b)
  • Formio.js version: 2.0.0-beta.4

Steps to Reproduce

  1. Install Docker tools. Enter formio directory
  2. From the terminal run, docker build -t dockerid/formio-server .
  3. Then run docker run -it --rm dockerid/formio-server

Expected behavior

Expected to see:

Initializing API Server.
 > Mongo connection established.
 > Serving the Form.io API Platform at http://localhost:3005

Observed behavior

internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module '/app/main'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Example:

Capture-docker

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
bohancommented, Sep 18, 2020

Hi @kidatsy , Thanks for the suggestion, I’ll try this out and revert shortly.

1reaction
heltumcommented, Apr 14, 2020

I think the problem in dockerfile. I tried to comment the WORKDIR and the error is just /main not /app/main. I guess ‘/main’ come from ENTRYPOINT in docker file

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module for a node js app running in a docker ...
If your Dockerfile and package.json files are correct and still have the issue: Make sure you've rebuilt your container images. Try. docker-compose down...
Read more >
Dockerized Node.js app Error: cannot find module - Compose
When I start a dockerized Node.js testapp with sudo docker-compose up I get the following error: Starting testapp_web_1 ... done Attaching ...
Read more >
Deploy failed when running balena deploy - openBalena
[Info] Emulation is enabled [Debug] Found build tasks: [Debug] main: ... Cannot find module './rebuild' [Build] app at Function.Module.
Read more >
module_not_found requirestack - You.com | The AI Search ...
Error: Cannot find module , code: 'MODULE_NOT_FOUND', requireStack: [] ... installed and have the correct version (if there is no folder, it will...
Read more >
Get started with Kubernetes (using Python)
What we'll do · Get the code and run the application locally · Create an image and run the application in Docker ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found