lielmusL
Denoβ€’11mo agoβ€’
3 replies
lielmus

error: Relative import path "@std/http/file-server" not prefixed with / or ./ or ../

I'm following this documentation to create a static files server https://docs.deno.com/examples/file_server_tutorial/
There seems to be problem with the first line of the code, which is

import { serveDir } from "@std/http/file-server";

I am getting the error

error: Relative import path "@std/http/file-server" not prefixed with / or ./ or ../
hint: If you want to use a JSR or npm package, try running deno add jsr:@std/http/file-server or deno add npm:@std/http/file-server

Which seems very strange to me, as its a standard library import, not anything relative.

What am I doing wrong?
Deno
In-depth documentation, guides, and reference materials for building secure, high-performance JavaScript and TypeScript applications with Deno
Write a file server
Was this page helpful?