Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image latest crashes on startup #96

Open
reconman opened this issue Nov 29, 2024 · 1 comment
Open

Docker image latest crashes on startup #96

reconman opened this issue Nov 29, 2024 · 1 comment

Comments

@reconman
Copy link
Collaborator

reconman commented Nov 29, 2024

Since the changes on October 24th, the docker image cannot start anymore:

node:internal/modules/cjs/loader:1228

�
  throw err;

  ^

Error: Cannot find module '/app/node'

    at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)

    at Module._load (node:internal/modules/cjs/loader:1051:27)

    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)

    at node:internal/main/run_main_module:28:49 {

  code: 'MODULE_NOT_FOUND',

  requireStack: []

}

Node.js v20.18.0

There are 2 reasons:

  1. The node argument probably needs to be removed from the CMD line since the image already inherits the entrypoint /nodejs/bin/node, so the CMD should only be src/index.js.
  2. The app itself is never copied into any of the images, only the package.json is. You removed most of the COPY lines which also includes copying the javascript files into the image, so the image only consists of node and npm dependencies.

Even after fixing both, the container still crashes with:

(node:1) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/app/src/index.js:2
import RssFeedEmitter from 'rss-feed-emitter';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (node:internal/modules/cjs/loader:1378:20)
    at Module._compile (node:internal/modules/cjs/loader:1428:41)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.18.0

The reason why I renamed index.js to index.mjs 2 years ago was because of this error.

@Ardakilic
Copy link
Owner

Hello, thanks for the input. Please follow the tags for the time being. I know there are issues, but I have not released the version yet, and nowadays sadly I don't have time to focus on this. I'll take care of these as soon as I have more time from my work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants