denosaurs/denon

Compatibility with Deno v1.15.3

tpiros opened this issue · 4 comments

I have the latest Deno version:

deno 1.15.3 (release, x86_64-apple-darwin)
v8 9.5.172.19
typescript 4.4.2

And I can't seem to use Denon. This is the output that I get when I first run the installation:

deno install -qAf --unstable https://deno.land/x/denon/denon.ts
error: TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname
                 ~~~
    at https://deno.land/std@0.53.0/path/win32.ts:911:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname;
                 ~~~
    at https://deno.land/std@0.53.0/path/posix.ts:433:18

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { ParseOptions, parse, parseAll } from "./_yaml/parse.ts";
         ~~~~~~~~~~~~
    at https://deno.land/std@0.53.0/encoding/yaml.ts:6:10

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
  DumpOptions as StringifyOptions,
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.53.0/encoding/yaml.ts:8:3

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { SchemaDefinition } from "./_yaml/schema.ts";
         ~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.53.0/encoding/yaml.ts:11:10

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { StyleVariant } from "./_yaml/type.ts";
         ~~~~~~~~~~~~
    at https://deno.land/std@0.53.0/encoding/yaml.ts:12:10

TS2339 [ERROR]: Property 'url' does not exist on type 'NetPermissionDescriptor'.
              return pd.url
                        ~~~
    at https://deno.land/std@0.53.0/permissions/mod.ts:16:25

TS2339 [ERROR]: Property 'url' does not exist on type 'NetPermissionDescriptor'.
                ? `--allow-${pd.name}=${pd.url}`
                                           ~~~
    at https://deno.land/std@0.53.0/permissions/mod.ts:17:44

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
  LevelName as LogLevelName,
  ~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/denon/deps.ts:8:3

TS2790 [ERROR]: The operand of a 'delete' operator must be optional.
    delete g.scripts;
           ~~~~~~~~~
    at https://deno.land/x/denon/src/runner.ts:48:12

TS2551 [ERROR]: Property 'Signal' does not exist on type 'typeof Deno'. 'Deno.Signal' is an unstable API. Did you forget to run with the '--unstable' flag, or did you mean 'signal'?
        Deno.kill(p.pid, Deno.Signal.SIGKILL);
                              ~~~~~~
    at https://deno.land/x/denon/src/daemon.ts:63:31

    'signal' is declared here.
      export function signal(sig: Signal): SignalStream;
                      ~~~~~~
        at asset:///lib.deno.unstable.d.ts:618:19

TS2551 [ERROR]: Property 'Signal' does not exist on type 'typeof Deno'. 'Deno.Signal' is an unstable API. Did you forget to run with the '--unstable' flag, or did you mean 'signal'?
        Deno.Signal.SIGHUP,
             ~~~~~~
    at https://deno.land/x/denon/src/daemon.ts:103:14

    'signal' is declared here.
      export function signal(sig: Signal): SignalStream;
                      ~~~~~~
        at asset:///lib.deno.unstable.d.ts:618:19

TS2551 [ERROR]: Property 'Signal' does not exist on type 'typeof Deno'. 'Deno.Signal' is an unstable API. Did you forget to run with the '--unstable' flag, or did you mean 'signal'?
        Deno.Signal.SIGINT,
             ~~~~~~
    at https://deno.land/x/denon/src/daemon.ts:104:14

    'signal' is declared here.
      export function signal(sig: Signal): SignalStream;
                      ~~~~~~
        at asset:///lib.deno.unstable.d.ts:618:19

TS2551 [ERROR]: Property 'Signal' does not exist on type 'typeof Deno'. 'Deno.Signal' is an unstable API. Did you forget to run with the '--unstable' flag, or did you mean 'signal'?
        Deno.Signal.SIGTERM,
             ~~~~~~
    at https://deno.land/x/denon/src/daemon.ts:105:14

    'signal' is declared here.
      export function signal(sig: Signal): SignalStream;
                      ~~~~~~
        at asset:///lib.deno.unstable.d.ts:618:19

TS2551 [ERROR]: Property 'Signal' does not exist on type 'typeof Deno'. 'Deno.Signal' is an unstable API. Did you forget to run with the '--unstable' flag, or did you mean 'signal'?
        Deno.Signal.SIGTSTP,
             ~~~~~~
    at https://deno.land/x/denon/src/daemon.ts:106:14

    'signal' is declared here.
      export function signal(sig: Signal): SignalStream;
                      ~~~~~~
        at asset:///lib.deno.unstable.d.ts:618:19

Found 15 errors.

If I execute the installation again, I get a success. But when I try to run my project (which does work just fine using deno run), I get:

deno denon run --allow-net app.ts                                   
[denon] v2.0.2
[denon] watching path(s): *.*
[denon] watching extensions: ts,js,json
[denon] starting `deno run --allow-net app.ts`
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'SIGHUP')
        Deno.Signal.SIGHUP,
                    ^
    at Daemon.onExit (https://deno.land/x/denon/src/daemon.ts:103:21)
    at Daemon.iterate (https://deno.land/x/denon/src/daemon.ts:123:10)
    at iterate.next (<anonymous>)
    at https://deno.land/x/denon/denon.ts:144:18

I think it's because the version of denon is not the latest version(v2.4.9).

This command may not install the latest version due to the cache:

deno install -qAf --unstable https://deno.land/x/denon/denon.ts

Therefore, you need to specify the version or add the reload option.

deno install -qAfr --unstable https://deno.land/x/denon/denon.ts
# or
deno install -qAf --unstable https://deno.land/x/denon@2.4.9/denon.ts

thanks @kamekyame - that seemed to have solved the issue! :)

Glad @tpiros you got your issue fixed. Running @kamekyame commands didn't help. Denon was working without issues yesterday. Today (less than 24 interval) and denon is failing. Running deno works and starts the app fine.

Running deno install -qAf --unstable https://deno.land/x/denon@2.4.9/denon.ts saysz

Warning Implicitly using latest version (2.4.9) for https://deno.land/x/denon/denon.ts

Then doing denon run --allow-net --allow-read --allow-env --unstable mod.ts throws the command line error

Check https://deno.land/x/denon/denon.ts
error: TS2339 [ERROR]: Property 'signal' does not exist on type 'typeof Deno'. 'Deno.signal' is an unstable API. Did you forget to run with the '--unstable' flag?
          await Deno.signal(s);
                     ~~~~~~
    at https://deno.land/x/denon@2.4.9/src/daemon.ts:157:22

Any hint on what the solution might be?

I faced the same issue when upgrading Deno to 1.16.0.
Probably due to the following changes:
https://deno.com/blog/v1.16#new-unstable-signal-listener-api

I made a new issue #144 .