Comments (15)
@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.
@monkingxue that's because Deno cache the files and doesn't send a network request.. (look at ~/.deno/src
)
from deno.
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.
@qti3e Reproduced this error and resolved this as you mentioned. thanks!
from deno.
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.
The server is up already, because the tests are pass before 06
, it seems like an issue about import on TypeScript.
from deno.
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.
@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.
@yorkie The tests before 006 don't use importing by url, so they can pass
from deno.
@monkingxue Can you provide the version of ts deno is using?
deno testdata/import_typescript.ts
from deno.
@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.
@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.
@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.
$ 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.
@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)
- `promise` never resolve with `npm:util` HOT 1
- Rewrite "node:worker_thread" "Worker" creation
- repl `attempt to subtract with overflow`
- "deno task" should support JSDoc as task description HOT 1
- Internal - Ability to write itest-like integration tests in the same folder HOT 1
- An error of `exclude` list wasn't caught by `deno publish --dry-run` HOT 1
- JUnit reporter: Output XML doesn't contain any details regarding failures on test "step"s HOT 2
- `js_unit_test::{read_text_file_test, websocket_test}` are flaky
- Deno compile - Precompile Wasm HOT 3
- Bug: tailwindcss v4 alpha errors on import
- Bug: Fast check cannot infer type from this export HOT 1
- npm-compat: ts-results issues HOT 3
- Deno.errors.NotFound incomplete type (and maybe others)
- [regression-1.41.2] error: 'import', and 'export' cannot be used outside of module code HOT 11
- "worker_threads is not handling "threadId" correctly
- Consider unstable flag to make cjs files be treated as esm HOT 6
- `deno publish` failed to resolve types from import in workspace HOT 1
- node:http server doesn't handle read errors HOT 3
- I hope compiling to native binary was added for Deno. HOT 1
- `deno compile` custom binaries
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deno.