解释npm ERR! arg Argument starts with non-ascii dash, this is probably invalid: –g npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name "–g" of package "–g": Tags may not have any characters that encodeURIComponent encodes. npm ERR! A complete log of this run can be found in: C:\Users\11833\AppData\Local\npm-cache\_logs\2023-05-23T15_20_52_627Z-debug-0.log
时间: 2023-07-09 13:05:25 浏览: 965
这个错误提示是由于你在使用npm安装包时在命令中使用了非ASCII破折号“–”作为参数的开头。这是无效的,因为npm不接受非ASCII字符作为参数开头。同时,它还指出了你使用了无效的标签名称“-g”,因为标签名称中不能包含任何被encodeURIComponent编码的字符。
为了解决此问题,你可以尝试使用ASCII破折号“-”而不是非ASCII破折号“–”,或者完全省略破折号,因为在大多数情况下,npm命令默认为全局安装。 如果你需要指定标签名称,请确保标签名称只包含ASCII字符,并且不包含被encodeURIComponent编码的字符。
相关问题
npm ERR! arg Argument starts with non-ascii dash, this is probably invalid: –g npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name "–g" of package "–g": Tags may not have any characters that encodeURIComponent encodes. npm ERR! A complete log of this run can be found in: npm ERR! D:\NVM\node_cache\_logs\2023-06-02T01_42_48_728Z-debug-0.log
这个错误是由于你在使用npm命令时,指定了一个无效的标签名“-g”。你需要使用正确的标签名,来对包进行安装或卸载。通常,“-g”是用于全局安装的标签名,如果你想要全局安装一个包,可以使用以下命令:npm install -g <package-name>。你可以查看完整的运行日志,以获取更多关于这个错误的信息。
請問這個報錯是什麼意思:arg Argument starts with non-ascii dash, this is probably invalid: –g, –registry=https://registry.npmmirror.com
这个报错的意思是,您的命令参数以一个非ASCII的破折号(–)开头,这可能是无效的。具体地说,这里的错误是针对参数 "-g" 和 "--registry=https://registry.npmmirror.com" 的。
在命令行中,应该使用ASCII编码的破折号(-)作为参数的开头。如果您使用了其他类型的破折号,例如Unicode破折号,那么命令行解析器将无法理解它们,并且会抛出此类错误。
解决此问题的一种方法是手动将参数中的破折号替换为ASCII破折号。例如,将参数 "-g" 替换为 "-g",将参数 "--registry=https://registry.npmmirror.com" 替换为 "--registry=https://registry.npmmirror.com"。
另外,在使用npm时,--registry参数通常用于指定npm包的镜像源,以加速下载速度。如果您使用的镜像源不是https://registry.npmjs.org,可以尝试使用--registry参数指定正确的镜像源。