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

bug(developer): kmc 17.0.220-alpha crashes with error on start #10111

Closed
srl295 opened this issue Nov 30, 2023 · 11 comments · Fixed by #10118
Closed

bug(developer): kmc 17.0.220-alpha crashes with error on start #10111

srl295 opened this issue Nov 30, 2023 · 11 comments · Fixed by #10118
Assignees
Milestone

Comments

@srl295
Copy link
Member

srl295 commented Nov 30, 2023

with this Dockerfile

FROM --platform=amd64 ubuntu:22.04
USER root
RUN apt-get -q -y update &&  \
  apt-get -q -y upgrade
RUN apt-get install -y -qq curl
# Install Node - yes, with a 60s delay
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash && \
  apt-get -q -y install nodejs

i get a failure

$ npm i -g @keymanapp/kmc@alpha
$ npm ls -g -a
(error messages)
$ kmc
(blows up)
node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/usr/lib/node_modules/@keymanapp/kmc/node_modules/@keymanapp/keyman-version/' imported from /usr/lib/node_modules/@keymanapp/kmc/build/src/kmc.js
    at new NodeError (node:internal/errors:405:5)
    at legacyMainResolve (node:internal/modules/esm/resolve:233:9)
    at packageResolve (node:internal/modules/esm/resolve:874:14)
    at moduleResolve (node:internal/modules/esm/resolve:936:20)
    at defaultResolve (node:internal/modules/esm/resolve:1129:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.17.1
@srl295 srl295 added this to the A17S27 milestone Nov 30, 2023
@srl295 srl295 self-assigned this Nov 30, 2023
@srl295
Copy link
Member Author

srl295 commented Nov 30, 2023

/usr/lib/node_modules/@keymanapp/kmc/node_modules/@keymanapp/keyman-version exists but is empty

@srl295
Copy link
Member Author

srl295 commented Nov 30, 2023

npm i -g @keymanapp/keyman-version@alpha 'works' as a workaround

srl295 added a commit to srl295/cldr that referenced this issue Nov 30, 2023
@srl295
Copy link
Member Author

srl295 commented Nov 30, 2023

| | +-- restructure@3.0.0 invalid: "git+https://github.com/keymanapp/dependency-restructure.git#7a188a1e26f8f36a175d95b67ffece8702363dfc" from node_modules/@keymanapp/kmc/node_modules/@keymanapp/common-types, "git+https://github.com/keymanapp/dependency-restructure.git#7a188a1e26f8f36a175d95b67ffece8702363dfc" from node_modules/@keymanapp/kmc/node_modules/@keymanapp/kmc-ldml

@mcdurdin
Copy link
Member

mcdurdin commented Dec 1, 2023

I reproduced this here both in a Docker container (node 18.17.1, npm 9.6.7) and on my local machine (node 18.14.1, npm 9.3.1):

  1. C:\Users\mcdurdin\AppData\Roaming\npm\node_modules@keymanapp\kmc\node_modules@keymanapp\common-types is empty
  2. C:\Users\mcdurdin\AppData\Roaming\npm\node_modules@keymanapp\kmc\node_modules@keymanapp\keyman-version is empty
  3. All other modules (developer-utils, kmc-kmn, etc, ldml-keyboard-constants) are populated.
  4. C:\Users\mcdurdin\AppData\Roaming\npm\node_modules@keymanapp\kmc\node_modules\restructure is empty
  5. C:\Users\mcdurdin\AppData\Roaming\npm\node_modules@keymanapp\kmc\node_modules\xml2js is empty

I installed 17.0.201-alpha and kmc ran, but restructure and xml2js are both invalid.

Comparing 17.0.201-alpha and 17.0.220-alpha is the next step.

One idea: we bring restructure and xml2js into the keymanapp repo and make them internal dependencies, at least until we replace them with updated published deps.

@mcdurdin
Copy link
Member

mcdurdin commented Dec 1, 2023

OK, so this broke with 17.0.206-alpha. Breaking change is bringing developer-utils in as a bundle dependency in #9940. This causes a cascade of missing dependencies:

@keymanapp/developer-utils has the following dependencies:

  • @keymanapp/common-types

@keymanapp/common-types has the following dependencies:

  • @keymanapp/keyman-version
  • restructure
  • semver
  • xml2js

And that is roughly the full set of empty folders in node_modules/@keymanapp/kmc/node_modules (there are a couple of others that are deps of those). So the problem is with bundleDependencies in kmc's package.json.

Two possible fixes I can see:

  1. Figure out how bundleDependencies handles nested deps and get it working
  2. Publish @keymanapp/developer-utils as a public npm package and avoid bundleDependencies altogether

I dislike the second option but honestly it's a whole lot simpler than the first one.

@mcdurdin mcdurdin changed the title bug(developer): kmc build issue 🙀 bug(developer): kmc 17.0.220-alpha crashes with error on start Dec 1, 2023
@mcdurdin mcdurdin removed the epic-ldml label Dec 1, 2023
@srl295
Copy link
Member Author

srl295 commented Dec 1, 2023

  • I'm not sure that xml2js and restructure are being pulled in properly either, we might consider publishing @keymanapp/xml2js even?

  • option 2 might make sense, let's give it a try.

@srl295
Copy link
Member Author

srl295 commented Dec 1, 2023

mkdir /tmp/test ; cd /tmp/test ; npm i @keymanapp/kmc@17.0.220-alpha ; npx kmc works fine btw. so it's only the global install that breaks.

@mcdurdin
Copy link
Member

mcdurdin commented Dec 1, 2023

  • I'm not sure that xml2js and restructure are being pulled in properly either, we might consider publishing @keymanapp/xml2js even?

Yep, will consider that if they don't work with this fix.

mkdir /tmp/test ; cd /tmp/test ; npm i @keymanapp/kmc@17.0.220-alpha ; npx kmc works fine btw. so it's only the global install that breaks.

Yes, so it smells very much like yet another npm bug. Would need to do a separate experiment I think to validate that, and I don't have capacity to chase this further just now.

@mcdurdin
Copy link
Member

mcdurdin commented Dec 1, 2023

I did a few minutes research and discovered npm/cli#3466 (reference) pointing to #7582 (comment)...

And now I am crying.

I don't think it is entirely the same issue, so perhaps should be reported separately and linked?

@mcdurdin
Copy link
Member

mcdurdin commented Dec 2, 2023

@srl295 can you retry from your end with 17.0.222-alpha?

@mcdurdin mcdurdin reopened this Dec 2, 2023
@srl295
Copy link
Member Author

srl295 commented Dec 8, 2023

This was working in the CLDR action, but i will do a rigorous local test.

@mcdurdin mcdurdin modified the milestones: A17S27, A17S28 Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants