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

Bug: glob no matches found error with deno task and npm-run-all #23525

Open
marvinhagemeister opened this issue Apr 24, 2024 · 4 comments
Open

Comments

@marvinhagemeister
Copy link
Contributor

Tried running the build command of the Preact repository and ran into this error.

Steps to reproduce

  1. Create a package.json file with these contents:
{
  "scripts": {
    "all": "npm-run-all foo:*",
    "foo:a": "echo 'a'",
    "foo:b": "echo 'b'"
  },
  "dependencies": {
    "npm-run-all": "^4.1.5"
  }
}
  1. Run npm i
  2. Run DENO_FUTURE=1 deno task all

Error

Deno:

$ deno task all 
Task all npm-run-all foo:*
glob: no matches found '/Users/marvinh/dev/test/deno-run-all/foo:*'

Node:

$ npm run all

> all
> npm-run-all foo:*


> foo:a
> echo 'a'

a

> foo:b
> echo 'b'

b

Version: Deno 1.42.4 (git 5294885 2024-04-24)

@marvinhagemeister marvinhagemeister added bug Something isn't working node compat labels Apr 24, 2024
@marvinhagemeister
Copy link
Contributor Author

Just noticed that the same issue can be reproduced with the svelte repo:

  1. Clone https://github.com/sveltejs/svelte
  2. Run pnpm i
  3. Run DENO_FUTURE=1 deno task build

@dsherret
Copy link
Member

I wouldn't consider this a bug because this is shell and environment dependent. The glob needs to be escaped so it's not expanded by whatever shell runs the task (ex. npm-run-all 'foo:*')

The reason it works with npm run OOTB in this case, is because the default sh shell attempts to expand foo:*, but doesn't find any matches and so it keeps it as foo:* to pass to npm-run-all (escaping can reduce the step of the shell doing a read_dir too).

If the default shell is zsh, this will fail like with deno task (deno task uses zsh's behaviour in this case because it's better IMO):

image

You can cause a failure with npm-run-all OOTB with sh by accidentally having a path that matches the glob. For example:
image

Ideally, the documentation of npm-run-all should be updated to instruct people to surround the glob in single quotes so it gets passed directly to the command instead of the current non-portable recommendation and wasting time doing a readdir.

@dsherret dsherret changed the title Bug: glob no matches found error with deno task Bug: glob no matches found error with deno task and npm-run-all Apr 24, 2024
@dsherret
Copy link
Member

Example of npm-run-all not working without quoting the shell expansion in yarn 2: mysticatea/npm-run-all#200

@dsherret
Copy link
Member

I opened mysticatea/npm-run-all#260

@dsherret dsherret removed the bug Something isn't working label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants