标签可能没有任何encodeURIComponent编码的字符

时间:2017-10-23 15:27:25

标签: npm bower yarnpkg

我正在从凉亭迁移到纱线,在我的bower.json文件中我有这种依赖:

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

当我尝试在yarn dependencies文件中执行相同操作时,我收到此错误:

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

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

两件事:

首先,npm包名称 - 由于纱线使用<div className="jumbotron col-sm-12 text-left row"> <div className="panel panel-info"> <div className="panel-heading"> HEADER </div> </div> <table className="table table-bordered table-condensed table-responsive"> <tbody> <tr> <td className="col-sm-6 col-centered leftCol"> <div> {"hello1"} </div> </td> </tr> <tr> <td className="col-sm-6 col-centered rightCol"> <div> {'hello2'} </div> </td> </tr> </tbody> </table> </div> </div> 而使用它 - 是package.jsonsnapsvg(带点)仅用于Bower。请参阅snapsvg npm page。您看到的错误是参考包名称中的那个点。

其次,当我测试用纱线1.2.1进行测试时,我注意到它抱怨0.4.1不可用:

snap.svg

生成的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 条目应如下所示:

package.json

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

yarn.lock

通常情况下,当发生类似这种奇怪的事情时,请手动使用yarn add包名称并查看其功能。