Tags may not have any characters that encodeURIComponent encodes

帅比萌擦擦* 提交于 2019-12-07 11:40:46

问题


I'm migrating from bower to yarn, and in my bower.json file I have this dependency:

Snap.svg": "snap.svg#^0.4.1

When I tried to do the same in the yarn dependencies file, I got this error :

npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "snap.svg@^0.4.1": Tags may not have any characters that encodeURIComponent encodes.

How can I solve this ?


回答1:


Two things:

First, the npm package name -- which yarn uses since it uses package.json -- is snapsvg whereas snap.svg (with a dot) is only used for Bower. See the snapsvg npm page. The error you see is in reference to that dot in the package name.

Second, when I test installed it with yarn 1.2.1, I noticed that it complained that 0.4.1 was not available:

Couldn't find any versions for "snapsvg" that matches "^0.4.1"
? Please choose a version of "snapsvg" from this list: (Use arrow keys)
> 0.5.1
  0.5.0
  0.4.0
  0.3.0
  0.1.0

The resulting package.json entry should look like:

"dependencies": {
  "snapsvg": "^0.4.0"
}

and yarn.lock:

snapsvg@^0.4.0:
  version "0.4.0"
  resolved "https://registry.yarnpkg.com/snapsvg/-/snapsvg-0.4.0.tgz#e0767014167825957de7e125c29b0fa89796ea03"
  dependencies:
    eve "~0.4.2"

Generally, when something weird like this happens, use yarn add with the package name manually and see what it does.



来源:https://stackoverflow.com/questions/46893065/tags-may-not-have-any-characters-that-encodeuricomponent-encodes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!