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

Following Getting Started Fails with error: Import assertions are deprecated. #154

Closed
tdharris opened this issue Oct 29, 2024 · 8 comments
Closed

Comments

@tdharris
Copy link

Following the Getting Started section fails with newer Deno, tried with latest Deno v2.0.3:

deno run -r --allow-read --allow-write https://deno.land/x/blog/init.ts .
deno task dev
Task dev deno run --allow-net --allow-read --allow-env --watch main.tsx --dev
Watcher Process started.
error: Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.

import emojis from "./all.json" assert { type: "json" };

  at https://deno.land/x/[email protected]/emoji.ts:2:1

Watcher Process failed. Restarting on file change...
@tdharris
Copy link
Author

tdharris commented Nov 2, 2024

Fixed by denosaurs/emoji v0.3.1 as mentioned in #151.

@willpuckett
Copy link
Contributor

willpuckett commented Nov 4, 2024

updating deps.ts gfm export to 0.10.0 seems to resolve this.

@willpuckett
Copy link
Contributor

You can import map till it's resolved...

 "imports": {
    "https://deno.land/x/[email protected]/mod.ts": "jsr:@deno/gfm"
  }

@tdharris
Copy link
Author

tdharris commented Nov 4, 2024

That fixes it! Thank you.

thisisjofrank added a commit that referenced this issue Nov 4, 2024
@JLCarveth
Copy link
Contributor

I am still getting this error.

➜  tmp mkdir testblog && cd testblog
➜  testblog deno run -r --allow-read --allow-write https://deno.land/x/blog/init.ts .
Warning Implicitly using latest version (0.7.0) for https://deno.land/x/blog/init.ts
Initializing blog in /home/jlcarveth/tmp/testblog...
Blog initialized, run `deno task dev` to get started.
➜  testblog deno task dev
Task dev deno run --allow-net --allow-read --allow-env --watch main.tsx --dev
Watcher Process started.
error: Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.

import emojis from "./all.json" assert { type: "json" };

  at https://deno.land/x/[email protected]/emoji.ts:2:1

Watcher Process failed. Restarting on file change...

@willpuckett
Copy link
Contributor

willpuckett commented Jan 24, 2025

You're using 0.7.0 which was released on 7/6/2023... in your deno.json/jsonc point the project to head ie something like

  "imports": {
    "deno_blog/": "https://pax.deno.dev/denoland/deno_blog/",

Then in main.tsx use something like

import blog from 'deno_blog/blog.tsx'

@JLCarveth
Copy link
Contributor

JLCarveth commented Jan 24, 2025

according to https://github.com/denoland/deno_blog/releases 0.7.0 is the latest. If this is not the case my apologies

Edit: But this is happening while cloning the main deno_blog project branch:

➜  es6 git clone [email protected]:denoland/deno_blog.git
Cloning into 'deno_blog'...
remote: Enumerating objects: 473, done.
remote: Counting objects: 100% (233/233), done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 473 (delta 185), reused 148 (delta 134), pack-reused 240 (from 2)
Receiving objects: 100% (473/473), 1.36 MiB | 7.22 MiB/s, done.
Resolving deltas: 100% (282/282), done.
➜  es6 cd deno_blog
➜  deno_blog git:(main) mkdir tmp
➜  deno_blog git:(main) cd tmp
➜  tmp git:(main) deno run -Ar ../init.ts .
Initializing blog in /home/jlcarveth/Developer/es6/deno_blog/tmp...
Blog initialized, run `deno task dev` to get started.
➜  tmp git:(main) ✗ deno task dev
Task dev deno run --allow-net --allow-read --allow-env --watch main.tsx --dev
Watcher Process started.
error: Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.

import emojis from "./all.json" assert { type: "json" };

  at https://deno.land/x/[email protected]/emoji.ts:2:1

Watcher Process failed. Restarting on file change...

@willpuckett
Copy link
Contributor

Apologies on my part. 0.7.0 is the latest release, but it's so old it doesn't include the fixes for deno 2.0. You'll need to use to git repo's mian branch directly. The release won't help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants