eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.94k stars 1.18k forks source link

Che docs devfile image cannot run preview server anymore #21725

Closed amisevsk closed 1 year ago

amisevsk commented 1 year ago

Describe the bug

The current quay.io/eclipse/che-docs:next image can no longer run the preview server, which fails to launch with message

+ vale sync
 SUCCESS  Downloaded package 'RedHat'                                                                                                                                           
 SUCCESS  Downloaded package 'CheDocs'                                                                                                                                          
Downloading packages [2/2] ███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 100% | 1s
+ LIVERELOAD=true
+ gulp
Error [ERR_REQUIRE_ESM]: require() of ES Module /opt/app-root/src/.npm-global/lib/node_modules/@antora/site-generator/node_modules/fast-copy/dist/fast-copy.cjs.js from /opt/app-root/src/.npm-global/lib/node_modules/@antora/site-generator/node_modules/pino-pretty/lib/utils.js not supported.
fast-copy.cjs.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename fast-copy.cjs.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /opt/app-root/src/.npm-global/lib/node_modules/@antora/site-generator/node_modules/fast-copy/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

    at Object.<anonymous> (/opt/app-root/src/.npm-global/lib/node_modules/@antora/site-generator/node_modules/pino-pretty/lib/utils.js:3:18)
    at Object.<anonymous> (/opt/app-root/src/.npm-global/lib/node_modules/@antora/site-generator/node_modules/pino-pretty/index.js:20:5)
    at Object.<anonymous> (/opt/app-root/src/.npm-global/lib/node_modules/@antora/site-generator/node_modules/@antora/logger/lib/logger.js:13:48)
    at Object.<anonymous> (/opt/app-root/src/.npm-global/lib/node_modules/@antora/site-generator/node_modules/@antora/logger/lib/index.js:16:18)
    at Object.<anonymous> (/opt/app-root/src/.npm-global/lib/node_modules/@antora/site-generator/lib/generator-context.js:4:19)
    at Object.<anonymous> (/opt/app-root/src/.npm-global/lib/node_modules/@antora/site-generator/lib/generate-site.js:3:26)
    at Object.<anonymous> (/opt/app-root/src/.npm-global/lib/node_modules/@antora/site-generator/lib/index.js:12:18)
    at Object.<anonymous> (/projects/che-docs/gulpfile.js:7:19)
    at async Promise.all (index 0) {
  code: 'ERR_REQUIRE_ESM'
}

Updating the devfile to instead use an older version of the che-docs image -- quay.io/eclipse/che-docs:3a32b32 (generated 12 days ago) -- allows starting the preview server as before.

Che version

next (development version)

Steps to reproduce

  1. Start a workspace using https://github.com/eclipse-che/che-docs.git
  2. Execute the run-preview-server task, note failure
  3. Update devfile to use quay.io/eclipse/che-docs:3a32b32 as the tools image instead and try again

Expected behavior

Development image should be able to run preview server

Runtime

OpenShift

Screenshots

No response

Installation method

other (please specify in additional context)

Environment

Linux

Eclipse Che Logs

No response

Additional context

I suspect it's related to https://github.com/eclipse-che/che-docs/pull/2450

themr0c commented 1 year ago

There was a problem with one of the images. The problem is solved but a created this followup task: https://issues.redhat.com/browse/RHDEVDOCS-4504 -- we should test the behavior of the built image before pushing it.