Tobias Lundin
Tobias Lundinโ€ข2mo ago

Node compat for `matchesGlob` from `node:path`?

Hi there ๐Ÿ‘‹ I'm new here but have been a deno fan from the get-go and have several project running on deno deploy v1 and v2 - love it!
I'm using deno 2.5.2 locally
Right now I'm attempting to deploy a tanstack-start app using the Nitro adapter (nightly v3 version) - https://nitro.build/deploy/providers/deno-deploy - https://tanstack.com/start/latest/docs/framework/react/hosting But using that I cant even build and this is the error I get:
deno task build
Task build vite build
error during build:
SyntaxError: The requested module 'node:path' does not provide an export named 'matchesGlob' at file:///Users/tobias/dev/tolu/tanstack-start-deno/node_modules/.deno/unstorage@2.0.0-alpha.3/node_modules/unstorage/dist/drivers/fs.mjs:2:35
at async createStorage (file:///Users/tobias/dev/tolu/tanstack-start-deno/node_modules/.deno/nitro-nightly@3.0.0-20251010-091540-0e3dbc69/node_modules/nitro-nightly/dist/_chunks/index.mjs:20195:22)
deno task build
Task build vite build
error during build:
SyntaxError: The requested module 'node:path' does not provide an export named 'matchesGlob' at file:///Users/tobias/dev/tolu/tanstack-start-deno/node_modules/.deno/unstorage@2.0.0-alpha.3/node_modules/unstorage/dist/drivers/fs.mjs:2:35
at async createStorage (file:///Users/tobias/dev/tolu/tanstack-start-deno/node_modules/.deno/nitro-nightly@3.0.0-20251010-091540-0e3dbc69/node_modules/nitro-nightly/dist/_chunks/index.mjs:20195:22)
I've simplified the issue to this code, and I dont really understand why this should not work?
import { matchesGlob } from 'node:path';
console.log(matchesGlob(Deno.cwd(), '**/*.json'));
import { matchesGlob } from 'node:path';
console.log(matchesGlob(Deno.cwd(), '**/*.json'));
terminal output:
โฏ deno run ./deno-test.ts
error: Uncaught SyntaxError: The requested module 'node:path' does not provide an export named 'matchesGlob'
import { matchesGlob } from 'node:path';
โฏ deno run ./deno-test.ts
error: Uncaught SyntaxError: The requested module 'node:path' does not provide an export named 'matchesGlob'
import { matchesGlob } from 'node:path';
What am I doing wrong here? Help very much appreciated! ๐Ÿ™๐Ÿ™๐Ÿ™
Deno Deploy - Nitro
Deploy Nitro apps to Deno Deploy.
Hosting | TanStack Start React Docs
Hosting is the process of deploying your application to the internet so that users can access it. This is a critical part of any web development project, ensuring your application is available to the...
7 Replies
fry69
fry69โ€ข2mo ago
I rewrote and expanded your test case a bit so it works in Node (24+) and should work Deno (fails of course as shown above):
import { matchesGlob } from "node:path";
import { readdirSync } from "node:fs";
import { join } from "node:path";
import process from "node:process";

const cwd = process.cwd();
const files = readdirSync(cwd);

console.log(`Testing matchesGlob() for files in: ${cwd}\n`);

files.forEach((file) => {
const fullPath = join(cwd, file);
const matches = matchesGlob(fullPath, "**/*.json");
console.log(`${file}: ${matches}`);
});
import { matchesGlob } from "node:path";
import { readdirSync } from "node:fs";
import { join } from "node:path";
import process from "node:process";

const cwd = process.cwd();
const files = readdirSync(cwd);

console.log(`Testing matchesGlob() for files in: ${cwd}\n`);

files.forEach((file) => {
const fullPath = join(cwd, file);
const matches = matchesGlob(fullPath, "**/*.json");
console.log(`${file}: ${matches}`);
});
Node output:
$ node main.ts
Testing matchesGlob() for files in: /node-matchesGlob

.git: false
deno.json: true
deno.lock: false
main.ts: false
$ node main.ts
Testing matchesGlob() for files in: /node-matchesGlob

.git: false
deno.json: true
deno.lock: false
main.ts: false
Deno stays the same:
$ deno fmt --check && deno lint && deno check
Checked 2 files
Checked 1 file
Check file:///node-matchesGlob/main.ts

$ deno main.ts
error: Uncaught SyntaxError: The requested module 'node:path' does not provide an export named 'matchesGlob'
import { matchesGlob } from 'node:path';
^
at <anonymous> (file:///node-matchesGlob/main.ts:1:10)
$ deno fmt --check && deno lint && deno check
Checked 2 files
Checked 1 file
Check file:///node-matchesGlob/main.ts

$ deno main.ts
error: Uncaught SyntaxError: The requested module 'node:path' does not provide an export named 'matchesGlob'
import { matchesGlob } from 'node:path';
^
at <anonymous> (file:///node-matchesGlob/main.ts:1:10)
I'd recommend to open an issue for this. Interesting, there is -> https://docs.deno.com/api/node/path/~/path.PlatformPath.matchesGlob But that seems only to exist as a type?
$ deno fmt --check && deno lint && deno check
Checked 2 files
Checked 1 file
Check file:///node-matchesGlob/main.ts
TS2693 [ERROR]: 'PlatformPath' only refers to a type, but is being used as a value here.
const matches = PlatformPath.matchesGlob(fullPath, "**/*.json");
~~~~~~~~~~~~
at file:///node-matchesGlob/main.ts:13:19

error: Type checking failed.
$ deno fmt --check && deno lint && deno check
Checked 2 files
Checked 1 file
Check file:///node-matchesGlob/main.ts
TS2693 [ERROR]: 'PlatformPath' only refers to a type, but is being used as a value here.
const matches = PlatformPath.matchesGlob(fullPath, "**/*.json");
~~~~~~~~~~~~
at file:///node-matchesGlob/main.ts:13:19

error: Type checking failed.
Tobias Lundin
Tobias LundinOPโ€ข2mo ago
That is interesting! But I think I'll go ahead and open an issue ๐Ÿ‘ Thanks!
fry69
fry69โ€ข2mo ago
Of course, that is more than justified. This documentation seems to be automatically generated from the Node types.
Tobias Lundin
Tobias LundinOPโ€ข2mo ago
GitHub
Node compat: running matchesGlob from node:path throws ยท Issue...
Version: Deno 2.5.2 (and 2.5.4) Deno errors when attempting to run matchesGlob from node:path My use case is attempting to get TanStack Start to run with Deno using the Nitro v2 adapter as describe...
fry69
fry69โ€ข2mo ago
This is now fixed in Deno canary:
$ deno upgrade canary
Current Deno version: v2.5.4
Looking up canary version

Found latest canary version cce15c39b8e5c22694a4d76e0dc355efa32e0dd3

Downloading https://dl.deno.land/canary/cce15c39b8e5c22694a4d76e0dc355efa32e0dd3/deno-aarch64-apple-darwin.zip
Deno is upgrading to version cce15c39b8e5c22694a4d76e0dc355efa32e0dd3

Upgraded successfully to Deno cce15c39b8e5c22694a4d76e0dc355efa32e0dd3 (canary)

$ deno run -A main.ts
Testing matchesGlob() for files in: /matchesGlob

main.ts: false
deno.json: true
README.md: false
deno.lock: false
.git: false
$ deno upgrade canary
Current Deno version: v2.5.4
Looking up canary version

Found latest canary version cce15c39b8e5c22694a4d76e0dc355efa32e0dd3

Downloading https://dl.deno.land/canary/cce15c39b8e5c22694a4d76e0dc355efa32e0dd3/deno-aarch64-apple-darwin.zip
Deno is upgrading to version cce15c39b8e5c22694a4d76e0dc355efa32e0dd3

Upgraded successfully to Deno cce15c39b8e5c22694a4d76e0dc355efa32e0dd3 (canary)

$ deno run -A main.ts
Testing matchesGlob() for files in: /matchesGlob

main.ts: false
deno.json: true
README.md: false
deno.lock: false
.git: false
Tobias Lundin
Tobias LundinOPโ€ข2mo ago
damn that was fast ๐Ÿ™Œ ๐Ÿ™‡โ€โ™‚๏ธ :fast_deno: And now I can build my app using nitro v3 (npm:nitro-nightly) - absolutely amazed at how quick that got a fix ๐Ÿ˜ thanks for the update @fry69!
fry69
fry69โ€ข2mo ago
Looking at the code/fix, it was probably a low hanging fruit/oversight.

Did you find this page helpful?