Font-Awesome icon indicating copy to clipboard operation
Font-Awesome copied to clipboard

Bug: Splatting operator @ cannot be used with adding npm kit on windows

Open barrychapman opened this issue 11 months ago • 6 comments

Bug description

PS D:\Projects\barrychapman> npm i --save @awesome.me/kit-0d80*****

As per docs: image

+ npm i --save @awesome.me/kit-0d80*****
+              ~~~~~~~~
The splatting operator '@' cannot be used to reference variables in an expression. '@awesome' can be used only as an argument to a command. To reference variables in an expression use '$awesome'.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : SplattingNotPermitted

Font Awesome version

v6

Application and Operating System

Webstorm Windows 11

Web bug report checklist

  • [X] I have included a test case because my odds go way up that the team can fix this when I do
  • [X] I have searched for existing issues and to the best of my knowledge this is not a duplicate

barrychapman avatar Mar 11 '24 16:03 barrychapman

Hello @barrychapman I have faced the same issues while trying to install the package using the Windows terminal. With git Git Bash it worked.

hagealex avatar Mar 12 '24 09:03 hagealex

Are there any OS related issue with npm and @ in file names?

tagliala avatar Mar 12 '24 10:03 tagliala

@tagliala I just saw this is an issue related to the Windows terminal:

Sometimes, the Windows command prompt interprets special characters differently. If you're using the command prompt, you might need to escape the "@" symbol by using a caret (^) before it, like this: npm install ^@package-name.

So for Windows terminal the command must be:

npm install ^@awesome.me/kit-KIT-CODE

Might be worth to add this to your documentation :)

hagealex avatar Mar 12 '24 12:03 hagealex

You can also use single quotes to get around this issue. For example: npm install '@awesome.me/kit-KIT-CODE'

CoderBrad avatar Mar 14 '24 21:03 CoderBrad

I'm not sure that this should be added to the docs, because it is platform-dependent, it is how the platform work, and I do not remember seeing instructions for different OSes in @ scoped node packages.

I think that a warning is more appropriate in this case

As an example, I can provide @popperjs/core, which is a very known package especially in bootstrap ecosystem.

Do you have examples of other packages with instructions specific to windows?

tagliala avatar Mar 20 '24 15:03 tagliala

The issue only occurs when the scope includes a . in the name (older versions of powershell had an issue with the @ as well but that was fixed a while ago at this point). I agree that a warning would be appropriate since most people will probably not encounter this issue. @neville.dabreo/greetingbot is a random example I found of a package with the same issue.

CoderBrad avatar Mar 23 '24 18:03 CoderBrad