`deno task build` failures in `node_modules/.deno/[email protected]/node_modules/fs-extra/lib/util/stat.js`
Version: Deno 1.40.2
I apologize for not being able to find a clean example to share. We're trying to update Quarto's bundled deno to 1.40.2 and we've run into a bit of trouble. We have an auxiliary TSC project that we've been building with deno task build in v1.37.2 without a problem. In v1.40.2, though, we see the following stack trace:
Task build tsc --noEmit && vite build
vite v3.2.6 building for production...
✓ 1169 modules transformed.
dist/quarto-preview.js 425.86 KiB / gzip: 125.28 KiB
[vite-plugin-static-copy:build] Function.prototype.apply was called on undefined, which is a undefined and not a function
[vite-plugin-static-copy] Copy count was not set.
error during build:
TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function
at getStatsCallbackified (ext:deno_node/_util/_util_callbackify.ts:53:26)
at Object.checkPaths (<PROJECT_ROOT>/node_modules/.deno/[email protected]/node_modules/fs-extra/lib/util/stat.js:36:29)
at Object.copy (<PROJECT_ROOT>/node_modules/.deno/[email protected]/node_modules/fs-extra/lib/copy/copy.js:33:8)
at <PROJECT_ROOT>/node_modules/.deno/[email protected]/node_modules/universalify/index.js:8:12
at new Promise (<anonymous>)
at Object.copy (<PROJECT_ROOT>/node_modules/.deno/[email protected]/node_modules/universalify/index.js:7:14)
at copyAll (<PROJECT_ROOT>/node_modules/.deno/[email protected]/node_modules/vite-plugin-static-copy/dist/index.js:530:16)
at eventLoopTick (ext:core/01_core.js:63:7)
at async Object.writeBundle (<PROJECT_ROOT>/node_modules/.deno/[email protected]/node_modules/vite-plugin-static-copy/dist/index.js:942:19)
at async Promise.all (index 0)
(I replaced the TSC project root with <PROJECT_ROOT> to make the stack trace easier to read.)
I've been unable to track down exactly why this succeeds in 1.37.2 and fails in 1.40.2. The problem is deterministic inside the Quarto source tree, so I have a simple but very unclean reproduction I'll share below share. But I haven't been able to deterministically trigger the problem outside the tree. Different invocations of the same deno binary will cause the crash to happen, while other times it doesn't.
I don't expect you to want to track down the full repro, but in case you do:
- working, using 1.37.2:
git clone https://github.com/quarto-dev/quarto-cli.git; cd quarto-cli; ./configure.sh - not working, using 1.40.2:
git clone https://github.com/quarto-dev/quarto-cli.git; cd quarto-cli; git checkout chore/1.5-dependency-refresh; ./configure.sh
The actual sub-project is src/webui/quarto-preview, which is built (eventually) through deno task build.
If you have a hunch of what might be causing this, I'm more than happy to help you come up with a minimal reproduction. I'm just a bit lost of where to proceed from here.
Thank you!
@littledivy looks related to https://github.com/denoland/deno/pull/21986/files
Seems we can't use ReflectApply:
> Reflect.apply(undefined)
VM239:1 Uncaught TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function
at <anonymous>:1:9
(anonymous) @ VM239:1
> Function.prototype.apply(undefined)
undefined