Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tags may not have any characters that encodeURIComponent encodes

Tags:

npm

bower

yarnpkg

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 ?

like image 886
Renaud is Not Bill Gates Avatar asked Oct 23 '17 15:10

Renaud is Not Bill Gates


1 Answers

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.

like image 69
msanford Avatar answered Oct 03 '22 22:10

msanford