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

deno task build failures in node_modules/.deno/[email protected]/node_modules/fs-extra/lib/util/stat.js #22180

Closed
cscheid opened this issue Jan 30, 2024 · 2 comments · Fixed by #22200
Assignees
Labels
bug Something isn't working correctly needs investigation requires further investigation before determining if it is an issue or not node compat

Comments

@cscheid
Copy link

cscheid commented Jan 30, 2024

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!

@kt3k kt3k added bug Something isn't working correctly needs investigation requires further investigation before determining if it is an issue or not compile related to the `deno compile` feature node compat and removed compile related to the `deno compile` feature labels Jan 30, 2024
@dsherret
Copy link
Member

@dsherret
Copy link
Member

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

littledivy added a commit that referenced this issue Feb 1, 2024
Fixes #22180

Matches the Node.js implementation more closely. Removed types, they do
not help just make it harder to debug with stack traces.
littledivy added a commit that referenced this issue Feb 1, 2024
Fixes #22180

Matches the Node.js implementation more closely. Removed types, they do
not help just make it harder to debug with stack traces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly needs investigation requires further investigation before determining if it is an issue or not node compat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants