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

The deployment failed: Relative import path "$fresh/plugins/twind.ts" not prefixed with / or ./ or ../ #139

Closed
christian-bromann opened this issue Oct 3, 2022 · 5 comments

Comments

@christian-bromann
Copy link

Hey πŸ‘‹

just started trying out Deno with Fresh and wanted to deploy a website using the deployctl command. My setup is a fresh pulled Fresh project, no changes made. Running:

deployctl deploy --project=runme.dev main.ts

Fails with:

√ Project: xxx
i Uploading all files from the current dir (/Users/xxx/Sites/xxx/projects/xxx)
√ Found 17 assets.
√ No new assets to upload.
Γ— Deployment failed.
error: The deployment failed: Relative import path "$fresh/plugins/twind.ts" not prefixed with / or ./ or ../

Anything I am missing?

@ayame113
Copy link

ayame113 commented Oct 5, 2022

I think it's similar to this issue: denoland/fresh#744

How about manually setting the --import-map flag?

@magurotuna
Copy link
Member

As @ayame113 said, currently we need to explicitly tell deployctl the path of import map file with --import-map, because deployctl is not aware of deno.json right now. I am looking into this issue so I think it will be solved shortly. Meanwhile please use --import-map.

@christian-bromann
Copy link
Author

Thanks, that did the trick!

@magurotuna
Copy link
Member

@christian-bromann FYI the issue is now fixed. Now deployctl automatically discovers and interprets deno.json so you can deploy it without providing --import-map option.

@m0rphed
Copy link

m0rphed commented Aug 10, 2024

Maybe it's just me doing things wrong, but I am still having this issue, deno-deploy does not read "imports" section inside deno.json, I am having troubles with Hono project:

{
  "imports": {
    "hono": "jsr:@hono/hono@^4.5.2",
    "@std/dotenv/load": "jsr:@std/dotenv/load"
  },
  "tasks": {
    "start": "deno run --allow-net --allow-read --allow-env main.ts"
  },
  "compilerOptions": {
    "jsx": "precompile",
    "jsxImportSource": "hono/jsx"
  },
  "deploy": {
    "exclude": [".env"],
    "include": ["./jsons", "*.ts"],
    "entrypoint": "./main.ts"
  }
}

main.ts:

import { Hono } from "hono";
import { serveStatic } from "hono/deno";
import { cache } from "hono/cache";
import { cors } from "hono/cors";
import "@std/dotenv/load"
import { parseKnownCurrencies } from "./processData.ts";
import { CurrencyApiResponse } from "./types.ts";
...

I am getting:

Γ— Deployment failed.
error: The deployment failed: Relative import path "@std/dotenv/load" not prefixed with / or ./ or ../

Which is strange for me - because locally with deno task start it all runs just fine on Deno version: πŸ¦• v1.45.4+8bab761

  • then is tried this:
import { Hono } from "hono";
import { serveStatic } from "hono/deno";
import { cache } from "hono/cache";
import { cors } from "hono/cors";
- import "@std/dotenv/load"
+ import "jsr:@std/dotenv/load"
import { parseKnownCurrencies } from "./processData.ts";
import { CurrencyApiResponse } from "./types.ts";
  • and now I am getting:
error: The deployment failed: Relative import path "hono/cors" not prefixed with / or ./ or ../

but hono is definitely in my imports

And, again, locally API running fine.. πŸ˜•

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

4 participants