0

I installed Deno using this choco install deno command, if I typed deno, I got the version, but if I try to run my index file, I got this error and whatever I typed i got the error like this(refer the image), what went wrong here, thank you

Uncaught SyntaxError: Unexpected identifier   
    at evaluate ($deno$/repl.ts:54:34)        
    at Object.replLoop ($deno$/repl.ts:156:13)

error

My index file

import {Application} from 'https://deno.land/x/oak/mod.ts';

import {PORT} from './config.js';
import router from '.router.js';

const app=new Application();

app.use(router.routes());
app.use(router.allwedMethods());

console.log('Server is running. Open http://localhost:${PORT}');

await app.listen({port:PORT});

config.js

export const PORT=5000;

router.js

import {Router} from 'https://deno.land/x/oak/mod.ts';

const router=new Router();

router.get('/',({response})=>{
    response.body='Working';
});

export default router;
FGH
  • 2,900
  • 6
  • 26
  • 59
  • 1
    `router.allwedMethods` should probably be `router.allowedMethods` (missing an 'o') – Lonnie Best Jun 03 '20 at 13:28
  • I changed it, thank you, but I got error ` The requested module 'https://deno.land/std@0.55.0/http/server.ts' does not provide an export named 'Router'` – FGH Jun 03 '20 at 14:24

2 Answers2

0

Can you try run the same RPL command with --ts flag like: deno run --allow-net --ts and all other flag you use

Nezir
  • 6,727
  • 12
  • 54
  • 78
0

I installed version 1.0.3 so that I got the error, After that, I uploaded to 1.0.0 or 1.0.5, I never get this warning

To solve this problem,

  1. Open the Command prompt to click Run as Administrator, After that
  2. Run this Command to scoop install deno@1.0.0
  3. Run The program again and Chech it.

# Install a specific version of deno:

scoop install deno@1.0.0

# Switch to v1.0.0

scoop reset deno@1.0.0

# Switch to the latest version

scoop reset deno 
FGH
  • 2,900
  • 6
  • 26
  • 59