denoland / deno

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

parser-ts fails to work in deno #24154

Open scarf005 opened 3 months ago

scarf005 commented 3 months ago

Version: deno 1.44.1+4d531bf (canary, x86_64-unknown-linux-gnu)

Reproducible example

// main.ts
import { run } from "npm:parser-ts/lib/code-frame"
import * as S from "npm:parser-ts/lib/string"

console.log(run(S.int, "abc"))
deno run main.ts

Current Behavior

error: Unable to load /home/scarf/.cache/deno/npm/registry.npmjs.org/parser-ts/0.7.0/lib/code-frame imported from file:///home/scarf/repo/conventional-commit/main.ts

Caused by:
    No such file or directory (os error 2)

Relevant code

$ cat /home/scarf/.cache/deno/npm/registry.npmjs.org/parser-ts/0.7.0/lib/code-frame.js

Object.defineProperty(exports, "__esModule", { value: true });
exports.run = void 0;
// ...
var run = function (p, source) { /* ... */ }
exports.run = run;
yazan-abdalrahman commented 3 months ago

Hello @satyarohith @scarf005 , while investigating this issue, I discovered that the path was incorrect for a npm package,

[cli\resolver.rs:286:5] &file_path = "C:\Users\Yazan.Abdalrahman\AppData\Local\deno\npm\registry.npmjs.org\parser-ts\0.7.0\lib\code-frame"

so I hard-coded path, but then I received another error.

[cli\resolver.rs:289:5] &file_path = "C:\Users\Yazan.Abdalrahman\AppData\Local\deno\npm\registry.npmjs.org\parser-ts\0.7.0\code-frame" error: Directory import C:\Users\Yazan.Abdalrahman\AppData\Local\deno\npm\registry.npmjs.org\parser-ts\0.7.0\code-frame is not supported resolving import from file:///D:/yad/deno/a.ts

Caused by: Access is denied. (os error 5)

Is this acceptable, or should it also be resolved? If that's acceptable, I'll attempt to set the correct path.