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

Error while running pnpm run schema with node v21 #23

Closed
bczhc opened this issue Nov 23, 2023 · 2 comments · Fixed by #26
Closed

Error while running pnpm run schema with node v21 #23

bczhc opened this issue Nov 23, 2023 · 2 comments · Fixed by #26

Comments

@bczhc
Copy link
Contributor

bczhc commented Nov 23, 2023

Error:

pnpm run schema

> @libreservice/[email protected] schema /mnt/4T/coll-last/open-source/my_rime
> node --loader ts-node/esm scripts/install_schemas.ts

(node:206029) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("ts-node/esm", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)

node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^
[Object: null prototype] {
  [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]]
}

Node.js v21.2.0
 ELIFECYCLE  Command failed with exit code 1.

I did some quick searching and found:

A fix for me is:

commit 1c376ce5e300f144b049857feed111037a69bc63
Author: Zhai Can <[email protected]>
Date:   Thu Nov 23 21:57:13 2023 +0800

    fix `pnpm run schemas` error with node 20+

diff --git a/tsconfig.json b/tsconfig.json
index a640dc7..5644228 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -14,5 +14,10 @@
     "noEmit": true
   },
   "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
-  "references": [{ "path": "./tsconfig.node.json" }]
+  "references": [{ "path": "./tsconfig.node.json" }],
+  "ts-node": {
+      "experimentalSpecifierResolution": "node",
+      "transpileOnly": true,
+      "esm": true
+  }
 }

I'm not sure if this can be considered as a proper fix, so just filed an issue instead of a PR :).

@bczhc bczhc changed the title Error while running pnpm run schema when node v21 Error while running pnpm run schema with node v21 Nov 23, 2023
@eagleoflqj
Copy link
Member

Tested locally with the latest node 21.4.0 and pnpm 8.11.0, there is no error.
Maybe upstream has fixed the issue.

@eagleoflqj eagleoflqj mentioned this issue Dec 8, 2023
@bczhc
Copy link
Contributor Author

bczhc commented Dec 8, 2023

OK then. I have no time to test it locally recently, but the PR has passed. This can be closed, and if there's something wrong again I will submit the follow-up of the issue.

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

Successfully merging a pull request may close this issue.

2 participants