2

I am trying to run a simple npm install with zsh terminal.

npm install --save-dev  @typescript-eslint/eslint-plugin@^4.0.0 
zsh: no matches found: @typescript-eslint/eslint-plugin@^4.0.0

It appears to be because of the @ in the name of the node module. I cannot find an answer to why this occurs, I have tried altering my path in ~/.zshrc to different values to no avail.

I am able to save any other node module without issue, if there is no @ within the name.

For additional information, it appears to be installing a specific version of a node module as opposed to the name. Running npm install --save-dev @typescript-eslint/eslint-plugin would work, but adding the @^4.0.0 causes the error zsh: no matches found.

1
  • Quote the plugin name: "@typescript-eslint/eslint-plugin@^4.0.0"
    – Panki
    Commented Nov 5, 2020 at 14:04

1 Answer 1

3

“no matches found” means that zsh thinks the word is a wildcard pattern. To tell zsh that you want to use the word literally rather than interpret it as a wildcard pattern, use quotes:

npm install --save-dev '@typescript-eslint/eslint-plugin@^4.0.0'
npm install --save-dev "@typescript-eslint/eslint-plugin@^4.0.0"
npm install --save-dev  @typescript-eslint/eslint-plugin@\^4.0.0

Either single quotes or double quotes work here. The difference between the two is that a few characters keep their special meaning within double quotes (!"$\`) but only ' itself keeps its special meaning after a ' (to terminate the single-quoted literal string). Alternatively, put a backslash before each character that has a special meaning to the shell.

Here the problematic character is not @, it's ^. @ doesn't need to be protected: it can be part of the wildcard construct @(…) but only when the kshglob option is enabled and it's followed by an opening parenthesis and the parenthesis would need to be quoted anyway and that would be enough to protect the @. ^ is not a wildcard character by default, but it is one (^foo means “everything that doesn't match foo”) when the very popular option extended_glob is enabled. ~ is also a wildcard character under extended_glob (foo~bar means “everything that matches foo except what matches bar”). ^ is also a history expansion character, but only if a word starts with ^ and contains another ^.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .