Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running scripts in %PATH%: Uncaught NotFound #102

Open
quaos opened this issue Sep 19, 2020 · 10 comments
Open

Running scripts in %PATH%: Uncaught NotFound #102

quaos opened this issue Sep 19, 2020 · 10 comments
Labels
bug Something isn't working

Comments

@quaos
Copy link

quaos commented Sep 19, 2020

Describe the bug
I'm working on both Windows 10 and MacOS machines.
Now running on Windows, I'm trying to setup denon script to call denopack which is in my %HOME%\.deno\bin and already included in %PATH% but got error: Uncaught NotFound: The system cannot find the file specified. (os error 2)

To Reproduce

  1. Create denon.json
"scripts": {
        "build": {
            "cmd": "denopack -c denopack.config.ts",
            "desc": "bundle my client.tsx file",
            "watch": false
        }
}
  1. Check that denopack is installed in %PATH%
where denopack
C:\Users\qua_o\.deno\bin\denopack.cmd

denopack --version
denopack/0.9.0 windows-x86_64 deno-1.3.3
  1. Run denon build

Expected behavior
It should run denopack -c denopack.config.ts

Configuration or Project
If applicable, add your denon configuration file or project so we can accurately test our solution.

Screenshots

denon build     
[*] [main] v2.4.0
[!] [#0] starting `denopack -c denopack.config.ts`
error: Uncaught NotFound: The system cannot find the file specified. (os error 2)
    at unwrapResponse (rt\10_dispatch_json.js:24:13)
    at sendSync (rt\10_dispatch_json.js:51:12)
    at opRun (rt\40_process.js:20:12)
    at Object.run (rt\40_process.js:104:17)
    at Runner.execute (https://deno.land/x/[email protected]/src/runner.ts:169:17)
    at Object.exe (https://deno.land/x/[email protected]/src/runner.ts:45:21)
    at Daemon.start (https://deno.land/x/[email protected]/src/daemon.ts:62:29)
    at Daemon.iterate (https://deno.land/x/[email protected]/src/daemon.ts:165:32)
    at iterate.next (<anonymous>)
    at https://deno.land/x/[email protected]/denon.ts:162:18

Setup

  • OS: Windows 10
  • Deno version: 1.3.3
  • Denon version: 2.4.0

Additional context
It can't neither find and run denon itself in %PATH%.

@quaos quaos added the bug Something isn't working label Sep 19, 2020
@quaos
Copy link
Author

quaos commented Sep 21, 2020

Just tested in Mac OS, it could run normally.

which denon
/Users/quaos/.deno/bin/denon

denon --version
[*] [main] v2.3.3

denon build
[*] [main] v2.3.3
[!] [#0] starting `denopack -c denopack.config.ts`
Generated denopack config: {
  input: "src/client.tsx",
  output: { dir: "./public/assets/js", sourcemap: true, format: "es" },
  plugins: [
    { name: "denopack-plugin-importResolver", resolveId: [Function: resolver] },
    { name: "denopack-plugin-cacheLoader", load: [AsyncFunction: load] },
    { name: "denopack-plugin-fileLoader", load: [AsyncFunction: load] },
    {
      name: "denopack-plugin-typescriptTransform",
      transform: [AsyncFunction: transform]
    }
  ]
}
denopack completed in 8275ms
[*] [daem] clean exit - denon is exiting ...

@notfilippo
Copy link
Collaborator

I think this could be an issue related to Deno.run. I will look into this.

@quaos
Copy link
Author

quaos commented Oct 2, 2020

I think this could be an issue related to Deno.run. I will look into this.

Thanks.

As for now, I'm using workaround like this:

    let cmd = ["denopack", "-c", "denopack.config.ts"];
    // Workaround for Windows
    // @ts-ignore TS2367
    if (/^(win|windows)$/.test(Deno.build.os)) {
      cmd = ["cmd", "/c"].concat(cmd);
    }
    const process: Deno.Process = Deno.run({
      cmd,
      env: Deno.env.toObject(),
    });

eliassjogreen added a commit that referenced this issue Oct 2, 2020
eliassjogreen added a commit that referenced this issue Oct 2, 2020
@eliassjogreen
Copy link
Member

I can't seem to replicate this on my windows machine? But I will make a patch for it anyways as it seems like a harmless thing to do which should solve your and other peoples problems. #105 should fix your issue

@eliassjogreen
Copy link
Member

Also update your deno version 😉

@PavelFlegr
Copy link
Contributor

The fix for this seems to be causing issues for me. With cmd /c used, when denon restarts the process, it closes the cmd process but deno processes that were launched from it stay open. In my case this prevents the new process from binding to the same port and it crashes. Removing the fix solves this.

@eliassjogreen
Copy link
Member

Relevant: #49 #7824

@PavelFlegr Think you could submit a pr for it and I will reopen this issue as it not properly closing seems like a bigger issue?

@eliassjogreen eliassjogreen reopened this Nov 8, 2020
@eliassjogreen
Copy link
Member

To solve this issue I think we should be able to manually just resolve the %path%/tool path and run that instead.

PavelFlegr added a commit to PavelFlegr/denon that referenced this issue Nov 8, 2020
@PavelFlegr
Copy link
Contributor

PavelFlegr commented Nov 8, 2020

It's a very small change but here's the pr #110

eliassjogreen added a commit that referenced this issue Nov 10, 2020
@hong4rc
Copy link
Contributor

hong4rc commented Dec 7, 2020

Window 10: 19042.630

$ deno --version 
deno 1.5.4 (bc79d55, release, x86_64-pc-windows-msvc)
v8 8.8.278.2
typescript 4.0.5

$ denon -v
[*] [main] v2.4.4

Create denopack.ts file:

console.log('this is denopack');
console.log(Deno.args);

and install it:

$ deno install denopack.ts
Check file:///C:/Users/path/to/denopack.ts
✅ Successfully installed denopack
{
  "$schema": "https://deno.land/x/denon/schema.json",
  "scripts": {
    "start": {
      "cmd": "denopack -c denopack.config.ts",
      "desc": "run my app.ts file"
    }
  }
}

Let run

$ denon start
[*] [main] v2.4.4
[*] [daem] watching path(s): *.*
[*] [daem] watching extensions: ts,tsx,js,jsx,json
[!] [#0] starting `denopack -c denopack.config.ts`
this is denopack
[ "-c", "denopack.config.ts" ]
[*] [daem] clean exit - waiting for changes before restart

image

Hmmm! No error :)

Can you change denopack -c denopack.config.ts to echo %PATH% or where denopack and check output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants