deploy_feedback icon indicating copy to clipboard operation
deploy_feedback copied to clipboard

[Bug]: Baffling "Module not found" Error

Open moonstripe opened this issue 1 year ago • 0 comments

Problem description

When I try to deploy my Fresh application to Deno Deploy, I get the following error message:

Error The deployment failed: Module not found "file:///Library/Caches/deno/npm/registry.npmjs.org/@portabletext/types/2.0.7/dist/index.d.ts".

I'm assuming it has to do with the import that I've labeled "to-html" in my deno.json

deno.json

{
  "lock": false,
  "tasks": {
    "check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
    "start": "deno run -A --watch=static/,routes/ dev.ts",
    "build": "deno run -A dev.ts build",
    "preview": "deno run -A main.ts",
    "update": "deno run -A -r https://fresh.deno.dev/update ."
  },
  "lint": {
    "rules": {
      "tags": [
        "fresh",
        "recommended"
      ]
    },
    "exclude": [
      "_fresh"
    ]
  },
  "fmt": {
    "exclude": [
      "_fresh"
    ]
  },
  "imports": {
    "$fresh/": "https://deno.land/x/[email protected]/",
    "preact": "https://esm.sh/[email protected]",
    "preact/": "https://esm.sh/[email protected]/",
    "preact-render-to-string": "https://esm.sh/*[email protected]",
    "@preact/signals": "https://esm.sh/*@preact/[email protected]",
    "@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
    "twind": "https://esm.sh/[email protected]",
    "twind/": "https://esm.sh/[email protected]/",
    "$std/": "https://deno.land/[email protected]/",
    "sanity": "https://esm.sh/@sanity/client",
    "openai": "npm:openai@^4.0.0",
    "to-html": "npm:@portabletext/to-html"
  },
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  }
}

I've removed all the typing to my use of the toHTML method from the aforementioned NPM package. What's going on? Why is it trying to pull from my cache??

Steps to reproduce

add "npm:@portabletext/to-html" to your dependencies try to deploy

Expected behavior

It should deploy fine.

Environment

deno 1.37.1 (release, x86_64-apple-darwin) v8 11.8.172.6 typescript 5.2.2

Possible solution

No response

Additional context

No response

moonstripe avatar Oct 01 '23 06:10 moonstripe