Closed Yovach closed 1 month ago
I'm having the same issue (well, with a different dependency but the exact same looking error message). Downgrading to 1.8.0 works.
I'm having the same issue (well, with a different dependency but the exact same looking error message). Downgrading to 1.8.0 works.
You can also downgrade to 1.9.0. The issue seems to be in these changes https://github.com/swc-project/swc-node/compare/@swc-node/register@1.9.0...@swc-node/register@1.9.1
I can confirm that downgrading to 1.9.0 also resolves this issue for me, thanks @Yovach
I just spent some time debugging why I'm getting this:
node:internal/process/esm_loader:34
internalBinding('errors').triggerUncaughtException(
^
Error: Failed to convert JavaScript value `Undefined` into rust type `String`
at Compiler.<anonymous> (/Users/daniel/Documents/mpi-15k-controller/.yarn/unplugged/@swc-core-virtual-78abd7d83c/node_modules/@swc/core/index.js:222:33)
at Generator.next (<anonymous>)
at /Users/daniel/Documents/mpi-15k-controller/.yarn/unplugged/@swc-core-virtual-78abd7d83c/node_modules/@swc/core/index.js:34:71
at new Promise (<anonymous>)
at __awaiter (/Users/daniel/Documents/mpi-15k-controller/.yarn/unplugged/@swc-core-virtual-78abd7d83c/node_modules/@swc/core/index.js:30:12)
at Compiler.transform (/Users/daniel/Documents/mpi-15k-controller/.yarn/unplugged/@swc-core-virtual-78abd7d83c/node_modules/@swc/core/index.js:208:16)
at transform (/Users/daniel/Documents/mpi-15k-controller/.yarn/unplugged/@swc-core-virtual-78abd7d83c/node_modules/@swc/core/index.js:350:21)
at transform (/Users/daniel/Documents/mpi-15k-controller/.yarn/__virtual__/@swc-node-core-virtual-a15c23fadb/3/.yarn/berry/cache/@swc-node-core-npm-1.13.1-7bd6e51ef2-10c0.zip/node_modules/@swc-node/core/lib/index.js:71:33)
at compile (/Users/daniel/Documents/mpi-15k-controller/.yarn/__virtual__/@swc-node-register-virtual-c40bc1c491/3/.yarn/berry/cache/@swc-node-register-npm-1.9.1-7aae79f2c8-10c0.zip/node_modules/@swc-node/register/lib/register.js:81:37)
at load (file:///Users/daniel/Documents/mpi-15k-controller/.yarn/__virtual__/@swc-node-register-virtual-c40bc1c491/3/.yarn/berry/cache/@swc-node-register-npm-1.9.1-7aae79f2c8-10c0.zip/node_modules/@swc-node/register/esm/esm.mjs:60:32) {
code: 'StringExpected'
}
Node.js v21.7.3
And I think it's the same cause, since downgrading to @swc-node/register@1.9.0 fixed it for me too.
If you want to reproduce, you can check out this commit: https://github.com/danieltroger/mpi-15k-controller/pull/1/commits/2f9bf9fc38840045b8afcac464a730270229b822
And do yarn && cd backend && yarn start
I narrowed down the specific exception I'm seeing to yarn not deciding to read the file contents of commonjs modules here:
But @swc-node/register
not handling that case properly
@yeliex would you mind follow up this issue introduced by the https://github.com/swc-project/swc-node/pull/767 ?
I will pay attention to this later today
I also have same issue as @danieltroger . Reference, action runner: https://github.com/psychobolt/vite-storybook-boilerplate/actions/runs/8972952433/job/24642078580 . Also reverting back to 1.9.0 fixed it as well.
Not exactly the same error message, but definitely a regression in 1.9.1
$ node --no-warnings=ExperimentalWarning --experimental-loader @swc-node/register/esm scripts/clean.ts
file:///Users/ray.pierce/source/ent-shared-components/node_modules/@swc-node/register/esm/esm.mjs:52
const swcAttribute = context.importAttributes.swc;
^
TypeError: Cannot read properties of undefined (reading 'swc')
at load (file:///Users/ray.pierce/source/ent-shared-components/node_modules/@swc-node/register/esm/esm.mjs:52:51)
at nextLoad (node:internal/modules/esm/loader:163:28)
at ESMLoader.load (node:internal/modules/esm/loader:603:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
at new ModuleJob (node:internal/modules/esm/module_job:64:26)
at #createModuleJob (node:internal/modules/esm/loader:480:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34)
Specifically, this is with Node 18.18.0 and @swc-node/register@1.9.1
.
When I bump to Node 18.19.0, everything works fine. If I stay on Node 18.18.0 and downgrade to @swc-node/register@1.9.0
, it also works again.
Not exactly the same error message, but definitely a regression in 1.9.1
$ node --no-warnings=ExperimentalWarning --experimental-loader @swc-node/register/esm scripts/clean.ts file:///Users/ray.pierce/source/ent-shared-components/node_modules/@swc-node/register/esm/esm.mjs:52 const swcAttribute = context.importAttributes.swc; ^ TypeError: Cannot read properties of undefined (reading 'swc') at load (file:///Users/ray.pierce/source/ent-shared-components/node_modules/@swc-node/register/esm/esm.mjs:52:51) at nextLoad (node:internal/modules/esm/loader:163:28) at ESMLoader.load (node:internal/modules/esm/loader:603:26) at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22) at new ModuleJob (node:internal/modules/esm/module_job:64:26) at #createModuleJob (node:internal/modules/esm/loader:480:17) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34)
Specifically, this is with Node 18.18.0 and
@swc-node/register@1.9.1
.When I bump to Node 18.19.0, everything works fine. If I stay on Node 18.18.0 and downgrade to
@swc-node/register@1.9.0
, it also works again.
node 18.18.0 does not support importAttributes, and experimental-loader
has been deprecated by node in higher version, I would try to add a polyfill to this
node 18.18.0 does not support importAttributes, and
experimental-loader
has been deprecated by node in higher version, I would try to add a polyfill to this
Should there be a minimum node version set for @swc-node/register
then?
Hi,
I'm using the
ws
package and I was able to run my project in@swc-node/register@1.9.0
but I've tried to upgrade to@swc-node/register@1.9.1
and I'm getting the following error :And the reproduction https://github.com/Yovach/regression-swc-node-register
Thanks!