FortAwesome / Font-Awesome

The iconic SVG, font, and CSS toolkit
https://fontawesome.com
Other
73.47k stars 12.19k forks source link

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

Open barrychapman opened 5 months ago

barrychapman commented 5 months ago

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

hagealex commented 5 months ago

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

tagliala commented 5 months ago

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

hagealex commented 5 months ago

@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 :)

CoderBrad commented 5 months ago

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

tagliala commented 5 months ago

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?

CoderBrad commented 5 months ago

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.