Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn 1.5.1 error An unexpected error occurred: "Can't add \"raphael\": invalid package version \"2.2.0b\".". #5417

Closed
Gemorroj opened this issue Feb 27, 2018 · 9 comments
Assignees
Labels

Comments

@Gemorroj
Copy link

yarn 1.5.1 (but works fine on 1.3.2)
execute yarn install

yarn-error.log:

Arguments: 
  C:\Program Files\nodejs\node.exe C:\Program Files (x86)\Yarn\bin\yarn.js install

PATH: 
  C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;s:\OpenServer\modules\php\PHP-7.1-x64;c:\Program Files\mingw-w64\x86_64-7.1.0-posix-seh-rt_v5-rev0\mingw64\bin;c:\_SOFT_\Git\bin;c:\_SOFT_\Git\usr\bin;c:\_SOFT_\oci;C:\Program Files (x86)\Avest\AvPCM_MNS;c:\_SOFT_\Blackfire\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Yarn\bin;C:\Program Files\nodejs\;s:\OpenServer\modules\database\MySQL-5.7-x64\bin\;C:\Users\dpa\AppData\Local\Yarn\bin;C:\Users\dpa\AppData\Roaming\npm

Yarn version: 
  1.5.1

Node version: 
  8.9.4

Platform: 
  win32 x64

npm manifest: 
  {
    "name": "topby",
    "version": "2.0.0",
    "description": "EDI провайдер",
    "private": true,
    "dependencies": {
      "babel-polyfill": "^6.26.0",
      "base64-js": "^1.2.3",
      "bignumber.js": "^6.0.0",
      "file-saver": "^1.3.3",
      "font-awesome": "^4.7.0",
      "jquery": "^3.3.1",
      "lodash": "^4.17.5",
      "moment": "^2.20.1",
      "select2": "^4.0.6-rc.1",
      "select2-bootstrap-theme": "^0.1.0-beta.10",
      "tui-editor": "^1.0.4"
    },
    "devDependencies": {
      "@symfony/webpack-encore": "^0.19.0",
      "ava": "^0.25.0",
      "babel-plugin-syntax-async-functions": "^6.13.0",
      "babel-preset-es2015": "^6.24.1",
      "bootstrap-sass": "^3.3.7",
      "node-sass": "^4.7.2",
      "sass-loader": "^6.0.6"
    },
    "scripts": {
      "test": "ava"
    },
    "ava": {
      "files": [
        "assets/tests/*.js"
      ],
      "source": [
        "assets/js/*.js"
      ],
      "failFast": true,
      "serial": true,
      "tap": false,
      "verbose": false,
      "require": [
        "babel-register"
      ]
    },
    "babel": {
      "presets": [
        "es2015"
      ],
      "plugins": [
        "syntax-async-functions",
        "transform-regenerator",
        "check-es2015-constants",
        "transform-es2015-block-scoping",
        "transform-es2015-classes",
        "transform-es2015-template-literals",
        "transform-es2015-parameters"
      ]
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
see bellow

Trace: 
  Error: Can't add "raphael": invalid package version "2.2.0b".
      at new MessageError (C:\Program Files (x86)\Yarn\lib\cli.js:186:110)
      at PackageRequest.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:36413:15)
      at Generator.next (<anonymous>)
      at step (C:\Program Files (x86)\Yarn\lib\cli.js:98:30)
      at C:\Program Files (x86)\Yarn\lib\cli.js:109:13
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)

yarn.lock.txt

@AndreyNikitin
Copy link

#5292 changed behavior

@rally25rs
Copy link
Contributor

It looks like tui-chart adds the dep to raphael:

  "dependencies": {
    "raphael": "https://github.com/nhnent/raphael.git#2.2.0b",

That GitHub repo does contain that branch and pacakge.json does have a matching version:
https://github.com/nhnent/raphael/blob/2.2.0b/package.json

2.2.0b is not valid semver:

~/Projects/yarn-test 🐒   node
> const s = require('semver');
undefined
> s.valid('2.2.0b')
null
> s.valid('2.2.0-b')
'2.2.0-b'

But it looks line in yarn 1.3.2 it somehow gets turned into 2.2.0-b instead, which is valid semver:

~/Projects/yarn-test 🐒   yarn list | grep raphael
├─ raphael@2.2.0-b
│  ├─ raphael@https://github.com/nhnent/raphael.git#2.2.0b

baburdick added a commit to HornsAndHooves/angular-pikaday-directive that referenced this issue Mar 1, 2018
@naganowl
Copy link
Contributor

naganowl commented Mar 8, 2018

I believe that the reason for this is that #5292 enforces semver too strictly on a package and breaks the functionality of allowing branch names from being specified in package.json.

I've run into this same problem and it's confirmed above since https://github.com/nhnent/raphael/tree/2.2.0b is a valid branch though an invalid semver.

@Gemorroj
Copy link
Author

nhn/tui.chart#40

@naganowl
Copy link
Contributor

@Gemorroj there's still an issue with yarn failing to pull in packages based off a branch name. Is this expected behavior in yarn moving forward?

@lightstrike
Copy link

Confirming I have same issue as @naganowl

@naganowl
Copy link
Contributor

Looks like there are fixtures for the upgrade flow that seem to support branches. Perhaps there's something broken with the add flow?

@naganowl
Copy link
Contributor

Took another look at my workflow and it turns out that my issue was indeed because the branch I was referencing had a package dependency whose version is invalid (2.3.1.3). Upon updating it, the issue went away. I was wrong to believe that branch references were broken.

@lightstrike perhaps another look at dependencies of your packages may reveal a similar issue.

@sitetester
Copy link

I fixed this problem by renaming yarn.lock to something else (1yarn.lock) and then running yarn install again ;D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants