mirror of
https://github.com/denoland/deno.git
synced 2025-10-03 07:34:36 +00:00

Apparently things like the `bin` field can appear in the version info from the registry, but not the package's `package.json`. I'm still not sure how you actually achieve this, but it's the case for `esbuild-wasm`. This fixes the following panic: ``` ❯ deno i --node-modules-dir npm:esbuild-wasm Add npm:esbuild-wasm@0.25.2 Initialize ⣯ [00:00] - esbuild-wasm@0.25.2 ============================================================ Deno has panicked. This is a bug in Deno. Please report this at https://github.com/denoland/deno/issues/new. If you can reliably reproduce this panic, include the reproduction steps and re-run with the RUST_BACKTRACE=1 env var set and include the backtrace in your report. Platform: macos aarch64 Version: 2.2.8+58c6c0b Args: ["deno", "i", "--node-modules-dir", "npm:esbuild-wasm"] View stack trace at: https://panic.deno.com/v2.2.8+58c6c0bc9c1b4ee08645be936ff9268f17028f0f/aarch64-apple-darwin/g4h6Jo393pB4k4kqBo-3kqBg6klqBogtyLg13yLw_t0Lw549Hgj8-Hgw__H428-F4yv_HgjkpKww7gIon4gIw54rKwi5MorzMw5y7G42g7Iw---I40s-I4vu4Jw2rEw8z7Dwnr6J4tp7Bo_vvK thread 'main' panicked at cli/npm/installer/common/bin_entries.rs:108:30: called `Option::unwrap()` on a `None` value note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
20 lines
415 B
TypeScript
20 lines
415 B
TypeScript
const name = Deno.args[0].trim();
|
|
|
|
function exists(path: string) {
|
|
try {
|
|
Deno.statSync(path);
|
|
return true;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if (
|
|
!(exists(`node_modules/.bin/${name}`) ||
|
|
exists(`node_modules/.bin/${name}.cmd`))
|
|
) {
|
|
console.log("missing bin");
|
|
console.log(`node_modules/.bin/${name}`);
|
|
console.log(Deno.readDirSync("node_modules/.bin").toArray());
|
|
Deno.exit(1);
|
|
}
|