Git Product home page Git Product logo

Comments (15)

monkingxue avatar monkingxue commented on April 28, 2024 1

@yuqingc Yeah, I also find this problem, but the error message is An import path cannot end with a '.ts', this isn't the real problem, is it?

from deno.

qti3e avatar qti3e commented on April 28, 2024 1

@monkingxue that's because Deno cache the files and doesn't send a network request.. (look at ~/.deno/src)

from deno.

qti3e avatar qti3e commented on April 28, 2024 1

Ok! I've could reproduce the error 🎉
while you run make test Deno uses a diffrent cache dir:
https://github.com/ry/deno/blob/180f0a1b3cfa0f7cd1f37485839c763de4d03693/integration_test.go#L73-L86

so it can't use this cached file later when you want to execute code by your self : (
so you should do:

cd $GOPATH/src/github.com/deno
http-server -p 4545

and then try the code again (deno testdata/006/...), after that close your http-server
now you can try the code again and it should just work...

I'll close this issue as resolved : )

from deno.

ulivz avatar ulivz commented on April 28, 2024 1

@qti3e Reproduced this error and resolved this as you mentioned. thanks!

from deno.

yuqingc avatar yuqingc commented on April 28, 2024

It seems that this package is imported from a server. Since there is no server running at 4545 port on your local computer which serves the exact ts file, it might fail importing modules from that url.

from deno.

yorkie avatar yorkie commented on April 28, 2024

The server is up already, because the tests are pass before 06, it seems like an issue about import on TypeScript.

from deno.

qti3e avatar qti3e commented on April 28, 2024

FYI; you'll see this in case of lack of server:

Downloading http://localhost:4545/testdata/subdir/print_hello.ts
/main.js:15737
                throw _iteratorError;
                ^
TypeError: Cannot read property 'compileAndRun' of undefined
    at ../runtime.ts:132:19
    at Array.map (<anonymous>)
    at localDefine (../runtime.ts:120:23)
    at eval (/home/qti3e/go/src/deno/testdata/006_url_imports.ts, <anonymous>)
    at Object.eval [as globalEval] (<anonymous>)
    at execute (../runtime.ts:185:3)
    at FileModule.compileAndRun (../runtime.ts:93:5)
    at ../main.ts:50:9
    at ../dispatch.ts:68:5

from deno.

monkingxue avatar monkingxue commented on April 28, 2024

@qti3e Yeah, if I run make test, all of tests are ok because the test.go will start a server. But when I use deno testdata/006_....., the error message isn't something about lacking of server, although I didn't start the server.

from deno.

monkingxue avatar monkingxue commented on April 28, 2024

@yorkie The tests before 006 don't use importing by url, so they can pass

from deno.

qti3e avatar qti3e commented on April 28, 2024

@monkingxue Can you provide the version of ts deno is using?

deno testdata/import_typescript.ts

from deno.

monkingxue avatar monkingxue commented on April 28, 2024

@qti3e Absolutely right, typescript version 2.8.3.But I find the print_hello.ts file in .deno/cache rather than .deno/src

from deno.

qti3e avatar qti3e commented on April 28, 2024

@mohsen1 So error is not related to TypeScript version as I have the same version...
btw, the file should be in ~/.deno/src/localhost:4545/testdata/subdir/print_hello.ts
if it's not maybe the issue is related to this?

from deno.

monkingxue avatar monkingxue commented on April 28, 2024

@qti3e I have removed the cache file and src file, and just re-run the deno 006... but it still told me that An import path cannot end with a '.ts' extension

from deno.

monkingxue avatar monkingxue commented on April 28, 2024

@qti3e

$ rm -rf ~/.deno/cache

$ rm -rf ~/.deno/src

$ deno testdata/006_url_imports.ts
Downloading http://localhost:4545/testdata/subdir/print_hello.ts
Downloading http://localhost:4545/testdata/subdir/print_hello.ts
Downloading http://localhost:4545/testdata/subdir/print_hello.ts
/Users/xueyingchen/Desktop/learn-one/go/src/github.com/ry/deno/testdata/006_url_imports.ts:1:28 - error TS2691: An import path cannot end with a '.ts' extension. Consider importing 'http://localhost:4545/testdata/subdir/print_hello' instead.

1 import { printHello } from "http://localhost:4545/testdata/subdir/print_hello.ts";
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ ls ~/.deno/cache
<empty>
$ ls ~/.deno/src
<empty>

from deno.

monkingxue avatar monkingxue commented on April 28, 2024

@qti3e, Yeah it's all right, but I think the error message should be lack of server when I didn't run the server port 4545.

from deno.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.