elm-script icon indicating copy to clipboard operation
elm-script copied to clipboard

Error when installing script

Open MartinSStewart opened this issue 5 years ago • 15 comments

I followed the instructions in the readme to install elm-script but I'm getting this error

% deno install -A -n elm-script ~/elm-script/runner/main.js
Download https://deno.land/std/path/mod.ts
Warning Implicitly using master branch https://deno.land/std/path/mod.ts
Download https://deno.land/std/path/_constants.ts
Download https://deno.land/std/path/win32.ts
Download https://deno.land/std/path/posix.ts
Download https://deno.land/std/path/common.ts
Download https://deno.land/std/path/separator.ts
Download https://deno.land/std/path/_interface.ts
Download https://deno.land/std/path/glob.ts
Warning Implicitly using master branch https://deno.land/std/path/glob.ts
Download https://deno.land/std/path/_globrex.ts
Download https://deno.land/std/testing/asserts.ts
Warning Implicitly using master branch https://deno.land/std/path/_interface.ts
Warning Implicitly using master branch https://deno.land/std/path/_constants.ts
Warning Implicitly using master branch https://deno.land/std/path/win32.ts
Download https://deno.land/std/path/_util.ts
Warning Implicitly using master branch https://deno.land/std/path/common.ts
Warning Implicitly using master branch https://deno.land/std/path/separator.ts
Warning Implicitly using master branch https://deno.land/std/path/posix.ts
Warning Implicitly using master branch https://deno.land/std/path/_globrex.ts
Warning Implicitly using master branch https://deno.land/std/testing/asserts.ts
Download https://deno.land/std/fmt/colors.ts
Download https://deno.land/std/testing/diff.ts
Warning Implicitly using master branch https://deno.land/std/path/_util.ts
Warning Implicitly using master branch https://deno.land/std/fmt/colors.ts
Warning Implicitly using master branch https://deno.land/std/testing/diff.ts
Compile file:///Users/martinstewart/elm-script/runner/main.js
error: Uncaught AssertionError: Unexpected skip of the emit.
    at Object.assert ($deno$/util.ts:33:11)
    at compile ($deno$/compiler.ts:1170:7)
    at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
    at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
    at file:///Users/martinstewart/elm-script/__anonymous__:1:1

I'm running on Mac OS

% deno --version
deno 1.0.4
v8 8.4.300
typescript 3.9.2

MartinSStewart avatar Jun 03 '20 11:06 MartinSStewart

Hmm tricky, haven't seen that one before...I wonder if those warnings are the key, though, it's implicitly getting the current development version of various standard library modules instead of an official release. Can you try changing line 6 of main.js to

import * as path from "https://deno.land/[email protected]/path/mod.ts";

or perhaps even an older version like

import * as path from "https://deno.land/[email protected]/path/mod.ts";

and see if that works?

ianmackenzie avatar Jun 03 '20 15:06 ianmackenzie

Oops actually it looks like the standard library has a different version number, so maybe try [email protected] (latest stable release) or [email protected] (which looks like it should be the version that corresponded to Deno 1.0) or something in that range...

ianmackenzie avatar Jun 03 '20 15:06 ianmackenzie

I'm getting similar looking output when I use either 0.50.0 or 0.55.0

% deno install -A -n elm-script ~/elm-script/runner/main.js
Download https://deno.land/[email protected]/path/mod.ts
Download https://deno.land/[email protected]/path/_constants.ts
Download https://deno.land/[email protected]/path/win32.ts
Download https://deno.land/[email protected]/path/posix.ts
Download https://deno.land/[email protected]/path/common.ts
Download https://deno.land/[email protected]/path/separator.ts
Download https://deno.land/[email protected]/path/_interface.ts
Download https://deno.land/[email protected]/path/glob.ts
Download https://deno.land/[email protected]/path/_util.ts
Download https://deno.land/[email protected]/testing/asserts.ts
Download https://deno.land/[email protected]/fmt/colors.ts
Download https://deno.land/[email protected]/testing/diff.ts
Download https://deno.land/[email protected]/path/_globrex.ts
Compile file:///Users/martinstewart/elm-script/runner/main.js
error: Uncaught AssertionError: Unexpected skip of the emit.
    at Object.assert ($deno$/util.ts:33:11)
    at compile ($deno$/compiler.ts:1170:7)
    at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
    at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
    at file:///Users/martinstewart/elm-script/__anonymous__:1:1

MartinSStewart avatar Jun 03 '20 16:06 MartinSStewart

I tried running deno install -A -n elm-script ~/elm-script/runner/main.js on a Windows 10 computer (no change to the line 6 import) and got the same error as I did on my Mac computer.

MartinSStewart avatar Jun 03 '20 17:06 MartinSStewart

Ah interesting! Yeah, just tested locally and I do get the same error if I update to 1.0.4 (I was on 1.0.0). 'Upgrading' to 1.0.3 seemed to make the problem go away for me: deno upgrade --version 1.0.3.

Not sure how to best figure out whether this is a Deno issue or an elm-script issue...kind of tempted to wait for 1.0.5 and see what happens 🙂

ianmackenzie avatar Jun 03 '20 17:06 ianmackenzie

Thanks, that gets me farther along. Now I'm getting error: The system cannot find the path specified. (os error 3) both on Windows and Mac. I'm pretty sure I'm giving it the correct path though.

MartinSStewart avatar Jun 03 '20 17:06 MartinSStewart

Huh weird - that's during the install step? I wonder if the problem is not that the path to main.js is wrong, but that Deno is trying to put the wrapper executable script in a particular directory and that directory doesn't exist. The docs mention that the wrapper script is installed to "the installation root's bin directory" - maybe figure out where the Deno installation root is on your machine and make sure there's a bin directory? I don't remember having to do that myself, though...

BTW the original error does look like an internal assert in the Deno compiler source: https://github.com/denoland/deno/blob/9c59a4b18c0aac3699d210c1f05f152651ddca28/cli/js/compiler.ts#L1170. If it's not fixed in 1.0.5 then I can look at trying to submit a nice issue.

ianmackenzie avatar Jun 03 '20 17:06 ianmackenzie

Here's the exact output I'm getting now (on my Mac with the 0.50.0 import)

 % deno install -A -n elm-script ~/elm-script/runner/main.js
Download https://deno.land/[email protected]/path/mod.ts
Download https://deno.land/[email protected]/path/win32.ts
Download https://deno.land/[email protected]/path/posix.ts
Download https://deno.land/[email protected]/path/common.ts
Download https://deno.land/[email protected]/path/separator.ts
Download https://deno.land/[email protected]/path/interface.ts
Download https://deno.land/[email protected]/path/glob.ts
Download https://deno.land/[email protected]/path/_globrex.ts
Download https://deno.land/[email protected]/testing/asserts.ts
Download https://deno.land/[email protected]/path/_constants.ts
Download https://deno.land/[email protected]/path/_util.ts
Download https://deno.land/[email protected]/fmt/colors.ts
Download https://deno.land/[email protected]/testing/diff.ts
error: No such file or directory (os error 2)

I'll look into if I've messed up something with Deno's installation

MartinSStewart avatar Jun 03 '20 17:06 MartinSStewart

One thing you might be able to try is skip the deno install step; for example, from the root of an elm-script checkout, instead of

elm-script run examples/HelloWorld.elm

try running

deno run -A runner/main.js run examples/HelloWorld.elm

instead. That might help narrow down whether the issue is with downloading dependencies (which should happen pretty much the same way in either version) or with installing the wrapper script (which the second version bypasses).

ianmackenzie avatar Jun 03 '20 17:06 ianmackenzie

I got it to work now (on Windows at least, I haven't tested Mac) by using Deno 1.0.0 instead. Strange that Deno gets buggier with each patch release 😄

MartinSStewart avatar Jun 03 '20 17:06 MartinSStewart

Yeah that's a bit concerning 😬

Thanks for working through all this! Deno and elm-script are both pretty young, hopefully this all gets smoother over time...

ianmackenzie avatar Jun 03 '20 17:06 ianmackenzie

I want to write a script that lists all the packages and package licenses used by an app so it's not a big deal if stuff is unstable as long as I can make it work at least once. Anyway, thanks for the help.

MartinSStewart avatar Jun 03 '20 17:06 MartinSStewart

OK, I'll leave this open for now to remind myself to check if this gets fixed in a future patch release of Deno, but I've also created #15 to switch to importing a specific tagged version of the standard library. That should avoid the warnings you initially encountered and seems like the right approach in general...

ianmackenzie avatar Jun 03 '20 17:06 ianmackenzie

Deno version 1.1 seems to have resolved this for me - can you try and see if it works for you?

Deno 1.1 did introduce another issue (or at least change in behavior) where it seems to always 'recompile' local .js files - so if you use the current installation instructions, you'll get an annoying pause every time you run elm-script as it 'recompiles' runner/main.js. As a workaround, I've uploaded the current version of the runner to https://elm-script.github.io/0.2; you should be able to run

deno install -f -A -n elm-script https://elm-script.github.io/0.2

to overwrite your current elm-script with the version published over HTTP (which I guess Deno generally trusts won't change over time, so doesn't try to re-download/recompile). You can still use the old instructions to 'link' to the local version of runner/main.js if you're trying out some local modifications; I'll update the README accordingly.

ianmackenzie avatar Jun 19 '20 19:06 ianmackenzie

I believe it resolved it for me too without me realizing it. I installed deno on another computer, installed elm-script, and everything went smoothly. I just checked and that version was 1.1

I haven't tried using elm-script from the url but the recompile time doesn't seem so bad. I might try it later though.

MartinSStewart avatar Jun 19 '20 19:06 MartinSStewart