denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.01k stars 5.39k forks source link

deno compile error [ERR_TYPES_NOT_FOUND] #25823

Open keelii opened 2 months ago

keelii commented 2 months ago

deno 2.0.0-rc.4 (release candidate, release, aarch64-apple-darwin) v8 12.9.202.13-rusty typescript 5.6.2

{
  "name": "test_deno",
  "version": "1.0.0",
  "main": "index.js",
  "description": "",
  "devDependencies": {
    "eslint-plugin-vue": "^9.28.0"
  }
}
import plugin from "eslint-plugin-vue";
➜  test_deno deno compile main.ts
error: Failed resolving types. [ERR_TYPES_NOT_FOUND] Could not find types for 'file:///Users/XXXX/test_deno/node_modules/eslint-plugin-vue/index.js' imported from 'file:///Users/zhouqili/test_deno/main.ts'
    at file:///Users/XXXX/test_deno/main.ts:1:20
marvinhagemeister commented 2 months ago

Looking at the files published in the eslint-plugin-vue there are indeed no types inside it. The package only contains .js files. Maybe we can find a way to ignore imports from packages by default. Does running the compile command with --no-check work?

deno compile --no-check main.ts
mstubenschrott commented 1 month ago

I have the same problem with the probe-image-size package (also just .js files inside). It also affects deno test and --no-check helps at least, but is not optimal.

igorbrasileiro commented 1 month ago

I'm facing this issue, but with deno check. The project uses remix + turbo(repo), and it's a monorepo.

the dropdown imports a file from another workspace.

error: Failed resolving types. [ERR_TYPES_NOT_FOUND] Could not find types for 'root-path/packages/ui/src/lib/utils.ts' imported from 'root-path/apps/../components/Dropdown.tsx'
yazan-abdalrahman commented 1 month ago

@keelii @marvinhagemeister I tried to reproduce it, but I got this outcome. If my steps of reproducing were correct, I believe it resolved.

https://github.com/user-attachments/assets/7fb0ae9d-b62c-400c-b5c1-75eade92d6e2

caroluchoa commented 1 month ago

@keelii @marvinhagemeister I tried to reproduce it, but I got this outcome. If my steps of reproducing were correct, I believe it resolved.

Recording.2024-10-09.143629.mp4

Hi Yazan, do you think this also resolves the error mentioned by @igorbrasileiro about the turbo+remix monorepo, when running deno check?

yazan-abdalrahman commented 1 month ago

and it's a monorepo.

Hi @caroluchoa , I don't think so; I need something reproducible for that issue to see if it works or not.

silverbucket commented 1 month ago

I'm running into this error as well.

error: Failed resolving types. [ERR_TYPES_NOT_FOUND] Could not find types for 'file:///path_to_project/node_modules/.deno/ajv-formats-draft2019@1.6.1/node_modules/ajv-formats-draft2019/index.js' imported from 'file:///path_to_project/packages/schemas/src/validator.ts'
  at file:///path_to_project/packages/schemas/src/validator.ts:5:34

That line (5):

import additionsFormats2019 from "ajv-formats-draft2019";

The package does not have typing: https://www.npmjs.com/package/ajv-formats-draft2019

I remember this working when I was running deno ~1.45.x, I just upgraded to 2.0.2 and that's when I started getting this error.