Closed echoptic closed 1 year ago
The problem seems to be with these lines: https://github.com/denoland/deno/blob/3b1cb8af69b0acf55c485ae3721bdb4d9322798e/ext/node/polyfills/process.ts#L64-L66
I think Deno[Deno.internal]?.nodeUnstable?.Command
doesn't lead to something that has a constructor
// @ts-ignore Deno[Deno.internal] is used on purpose here
const DenoCommand = Deno[Deno.internal]?.nodeUnstable?.Command;
console.log(new DenoCommand);
1.30.0:
deno run main.ts
Command {}
1.31.3:
deno run main.ts
error: Uncaught TypeError: DenoCommand is not a constructor
console.log(new DenoCommand);
Did a bisect and found f917d2e2c10e0a94e564a9016217e7ce27c8bbee caused this bug.
Nice find @GJZwiers, it seems like an omission on my side - sorry for that. The first would be to not depend on Deno[Deno.internal]
but instead directly import proper API in ext/node/polyfills/http.ts
from ext:deno_http/
. Would it be some you'd be interested in tackling?
I have opened https://github.com/denoland/deno/pull/18289
@echoptic Thanks for reporting the bug, it should be fixed in the next release, however there is another open issue when using npm:puppeteer
that you would run into: https://github.com/denoland/deno/issues/17496. As an alternative I believe you can use https://deno.land/x/puppeteer instead.
@echoptic What does that mean?
error: Uncaught (in promise) TypeError: Deno.Command is not a constructor
const proc = new Deno.Command(Deno.execPath(), {
^
at generate (https://deno.land/x/fresh@1.1.5/src/dev/mod.ts:137:16)
at https://deno.land/x/fresh@1.1.5/init.ts:349:7
@Amad3eu you're probably on very old version of Deno. It will work if you upgrade
@bartlomieju I believe not too old, but I'm on deno 1.27.2 (release, x86_64-unknown-linux-gnu)
At that point Deno.Command
was unstable API and wasn't available unless --unstable
flag was provided.
I had the same issue today. The conda-forge https://anaconda.org/conda-forge/deno package of deno installs an older version perhaps. Deno Fresh installs using --unstable
flag but doesn't run using --unstable
flag.
OS: Win 10
(deno) C:\conda>deno --version
deno 1.29.2 (release, x86_64-pc-windows-msvc)
v8 10.9.194.5
typescript 4.9.4
--unstable
flage(deno) C:\conda>deno run -A -r https://fresh.deno.dev my-project
� Fresh: the next-gen web framework.
Let's set up your new Fresh project.
Fresh has built in support for styling using Tailwind CSS. Do you want to use this? [y/N] y
Do you use VS Code? [y/N] y
error: Uncaught (in promise) TypeError: Deno.Command is not a constructor
const proc = new Deno.Command(Deno.execPath(), {
^
at generate (https://deno.land/x/fresh@1.1.5/src/dev/mod.ts:137:16)
at https://deno.land/x/fresh@1.1.5/init.ts:349:7
--unstable
flag makes it work.(deno) C:\conda>deno --unstable run -A -r https://fresh.deno.dev denofresh
� Fresh: the next-gen web framework.
Let's set up your new Fresh project.
Fresh has built in support for styling using Tailwind CSS. Do you want to use this? [y/N] y
Do you use VS Code? [y/N] y
The manifest has been generated for 3 routes and 1 islands.
Project initialized!
Enter your project directory using cd denofresh.
Run deno task start to start the project. CTRL-C to stop.
Stuck? Join our Discord https://discord.gg/deno
Happy hacking! �
--unstable
flag(deno) C:\conda\denofresh>deno task start
Task start deno run -A --watch=static/,routes/ dev.ts
Watcher Process started.
error: Uncaught (in promise) TypeError: Deno.Command is not a constructor
const proc = new Deno.Command(Deno.execPath(), {
^
at generate (https://deno.land/x/fresh@1.1.5/src/dev/mod.ts:137:16)
at dev (https://deno.land/x/fresh@1.1.5/src/dev/mod.ts:184:30)
at async file:///C:/conda/denofresh/dev.ts:5:1
Watcher Process finished. Restarting on file change...
--unstable
flag(deno) C:\conda\denofresh>deno --unstable task start
Task start deno run -A --watch=static/,routes/ dev.ts
Watcher Process started.
error: Uncaught (in promise) TypeError: Deno.Command is not a constructor
const proc = new Deno.Command(Deno.execPath(), {
^
at generate (https://deno.land/x/fresh@1.1.5/src/dev/mod.ts:137:16)
at dev (https://deno.land/x/fresh@1.1.5/src/dev/mod.ts:184:30)
at async file:///C:/conda/denofresh/dev.ts:5:1
Watcher Process finished. Restarting on file change...
I tried running:
and got the error: