Relative import path "oak/router" not prefixed with / or ./ or ../ and not in import map
I get the above message when attempting to deploy to Deno Deploy via github actions. The same does not occur when running locally with
deno run -A src/main.ts
.
deploy.yaml:
deno.json:
src/main.ts
I know what the error means and I've fixed it before in other cases. From what I can see my configuration is correct, so I'm trying to figure out why I might be getting it only in the action execution. Could anyone lend an eye? thanks4 Replies
I have figured out that explicitly adding the sub paths of the imports to my
deno.json
file seems to solve the issue, for example:
if I want to use oak/router
in main.ts, I have to add "oak/router": "jsr:@oak/oak@17.0.0/router",
to deno.json
(ontop of the already existing oak
import). This is weird, because locally I can just have the top level oak
import and deno automatically resolves jsr:@oak/oak@17.0.0/router
when I specify oak/router
. I wonder why this is different when deploying, perhaps something to do with deployctl
?I also got the same error, it happens in the deno versions above 2.1.4
@zing remove the
import-map:
entry in your deploy action. The deno.json
file is not an import map. It's likely that it tried to parse it as such, didn't find any import and the erroredthanks for your reply. I had added that import map as part of a few initial attempts to get around this issue, and interestingly it does work using that, combined with my workaround mentioned above. Subsequently though I have removed it and tested removing some of my explicit imports from
deno.json
, which to my surprise has started working. So essentially my project is back in the state that it was when I first ran into this issue(at least I think it is) however it is now working. maybe something is fixed now or of course I could have been mistaken all along 🙂 thanks