DenoDDeno
Powered by
lielmusL
Denoβ€’14mo 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
deno add jsr:@std/http/file-server
or
deno add npm:@std/http/file-server
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
Write a file server
In-depth documentation, guides, and reference materials for building secure, high-performance JavaScript and TypeScript applications with Deno
Write a file server
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Relative import path "ioredis" not prefixed with / or ./ or ../
bajosiBbajosi / help
3y ago
The deployment failed: Relative import path "$fresh/server.ts" not prefixed with / or ./ or ../
OokerOOoker / help
3y ago
Import from "@std/yaml/parse" or "@std/yaml" throwing relative path error.
IdeasAndActionIIdeasAndAction / help
2y ago
'Relative import path not prefixed' error from @types/express .d.ts file?
rally25rsRrally25rs / help
3y ago