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.

Zod 3.10.x is broken on node 12

See original GitHub issue

Repro:

$ docker run -ti --rm --entrypoint sh node:12-slim -c "npm i zod@3.10.1 && node -e \"require('zod').number().parse('5')\""

...

/node_modules/zod/lib/types.js:82
            path: params?.path || [],
                         ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
colinhackscommented, Oct 19, 2021

Sorry, the TypeScript compilation target got set to "es2020" by accident. Fixed in zod@3.10.3.

2reactions
synccommented, Oct 19, 2021

Null coalescing isn’t supported in Node 12. I think changing this library target to ES2019 inside tsconfig should fix the issue.

Screen Shot 2021-10-19 at 11 10 41 am
Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing the end of support for Node.js 12.x in ...
Starting November 1, 2022, AWS SDK For JavaScript (v3) will no longer support Node.js 12.x which was EOL on April 30, 2022. We...
Read more >
How do I fix this zod error I am getting while deploying ...
I believe to have found where the error is in my code, I just don't know how to fix it. It is the...
Read more >
Node v12.22.12 (LTS)
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
Read more >
Build a REST API with Node.js, Express, TypeScript ...
js, Express, TypeScript, MongoDB & Zod.
Read more >
All Actions will begin running on Node16 instead of Node12
Node 12 has been out of support since April 2022, as a result we have started the deprecation process of Node 12 for...
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