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

Error executing sample script from https://deno.land/x/opine #39

Closed
rglowrey opened this issue Jul 2, 2020 · 6 comments
Closed

Error executing sample script from https://deno.land/x/opine #39

rglowrey opened this issue Jul 2, 2020 · 6 comments
Labels
bug Something isn't working dependencies

Comments

@rglowrey
Copy link

rglowrey commented Jul 2, 2020

Issue

Setup:

  • Deno Version: 1.1.2
  • v8 Version: 8.5.216
  • Typescript Version: 3.9.2
  • Opine Version: opine@main/mod.ts
  • (environment variable) DENO_INSTALL=/home/rick/.deno

Error when executing deno sample script from https://deno.land/x/opine

Details

I saved the sample script with name "sampleOpine.ts", then executed it as below. It threw an error as follows:

deno run sampleOpine.ts
Check file:///home/rick/Working/Playpen/deno/OpineTemplate/sampleOpine.ts
error: TS2305 [ERROR]: Module '"./_utils"' has no exported member 'normalizeEncoding'.
import { notImplemented, normalizeEncoding } from "./_utils.ts";
~~~~~~~~~~~~~~~~~
at https://deno.land/std/node/buffer.ts:3:26

Not quite sure what to do with this, or if it's my configuration that's the problem. NB: I was able to successfully run a Deno server app using OAK on the same machine.

@asos-craigmorten
Copy link
Collaborator

@rglowrey ah yes, saw this is in one of my other repos - one of the subdependencies hasn’t locked its versions causing this issue - I’ll get a patch out this morning shortly.

@asos-craigmorten
Copy link
Collaborator

asos-craigmorten commented Jul 3, 2020

@rglowrey please can you try out 0.17.0 and see if that is fixed for you? 🙂 I would also recommend always using a specific version of opine - the main branch is not 100% guaranteed to be stable (though is generally the plan!).

REF: https://github.com/asos-craigmorten/opine/releases/tag/0.17.0

@asos-craigmorten asos-craigmorten added bug Something isn't working dependencies labels Jul 3, 2020
@rglowrey
Copy link
Author

rglowrey commented Jul 3, 2020

No, didn't fix it.

Here's the code I ran:

import { opine } from "https://deno.land/x/opine@0.17.0/mod.ts";

const app = opine();

app.use((req, res) => {
  res.send("Hello World");
});

app.listen(3000);

Here's the result:

rick@rick-XPS-8920:~/Working/Playpen/deno/OpineTemplate$ deno run --allow-net sampleOpine.ts
Check file:///home/rick/Working/Playpen/deno/OpineTemplate/sampleOpine.ts
error: TS2305 [ERROR]: Module '"./_utils"' has no exported member 'normalizeEncoding'.
import { notImplemented, normalizeEncoding } from "./_utils.ts";
                         ~~~~~~~~~~~~~~~~~
    at https://deno.land/std/node/buffer.ts:3:26

@asos-craigmorten
Copy link
Collaborator

asos-craigmorten commented Jul 3, 2020

@rglowrey Hmm... the classic and somewhat unhelpful "works for me"!

Can you try with the --reload flag? I wonder if you've got a cached "bad" subdependency somewhere? I.e.

$ deno run --allow-net --allow-read --reload sampleOpine.ts

@rglowrey
Copy link
Author

rglowrey commented Jul 3, 2020

Now I get to give the classic "so it really WAS me all along!". Yes, running with the --reload flag did the trick. Also, when I ran it with the first line
import { opine } from "https://deno.land/x/opine@main/mod.ts";
it worked fine after that --reload. Thanks for your help, and sorry for the bother.

@asos-craigmorten
Copy link
Collaborator

@rglowrey no bother at all! I believe the initial problem lay with Opine 😂 or specifically one of it's dependencies - something I think needs ironed out in Deno is sub-dependency resolution, conflicts etc. I don't think there is a way to "lock" versions for consumers of a module. The only thing consumers can do afaik is find a "good" version and then use the --lock-write and subsequently --lock flags to protect themselves from these errors - I don't think it can be fixed upstream just yet...?

Glad it works now anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies
Projects
None yet
Development

No branches or pull requests

2 participants