Skip to content

Upgrade v3 to v4 fails in yarn workspaces: TypeError: Invalid Version: N/A #4781

Closed
@franciscolourenco

Description

@franciscolourenco

Version

4.0.5

Reproduction link

https://github.com/reproducing/vue-cli-upgrade-yarn-workspaces

Environment info

Environment Info:

  System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  Binaries:
    Node: 12.6.0 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 78.0.3904.70
    Firefox: 69.0.3
    Safari: 13.0.3
  npmPackages:
    @vue/cli-overlay:  3.11.0
    @vue/cli-service: ^3.11.0 => 3.11.0
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

  1. Install yarn globally
  2. Install @vue/cli 4.0.5 globally
  3. Clone repo and cd into one of the packages repo/a or repo/b
  4. Run vue upgrade

What is expected?

Should upgrade without errors

What is actually happening?

It doesn't find the vue-cli packages from package.json

$ vue --version
@vue/cli 4.0.5

$ vue upgrade
⠋  Gathering package information... ERROR  TypeError: Invalid Version: N/A
TypeError: Invalid Version: N/A
    at new SemVer (/Users/user/.config/yarn/global/node_modules/@vue/cli/node_modules/semver/semver.js:332:11)
    at compare (/Users/user/.config/yarn/global/node_modules/@vue/cli/node_modules/semver/semver.js:647:10)
    at Function.lt (/Users/user/.config/yarn/global/node_modules/@vue/cli/node_modules/semver/semver.js:688:10)
    at Upgrader.getUpgradable (/Users/user/.config/yarn/global/node_modules/@vue/cli/lib/Upgrader.js:212:20)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
    at async Upgrader.checkForUpdates (/Users/user/.config/yarn/global/node_modules/@vue/cli/lib/Upgrader.js:229:24)
    at async upgrade (/Users/user/.config/yarn/global/node_modules/@vue/cli/lib/upgrade.js:24:24)

Running vue upgrade @vue/cli-service works, but it adds a duplicate @vue/cli-service entry in package.json, so it still doesn't see the original entry.

@vue/cli 3.12.1 seems to be affected as well, even though it doesn't throw an error:

$ vue --version
3.12.1

$ vue upgrade major
✔  Gathering update information...
These packages can be upgraded:

 package                         installed     upgraded
 @vue/cli-plugin-babel                 N/A  →    ^4.0.5
 @vue/cli-plugin-e2e-nightwatch        N/A  →    ^4.0.5
 @vue/cli-plugin-eslint                N/A  →    ^4.0.5
 @vue/cli-plugin-unit-jest             N/A  →    ^4.0.5
 @vue/cli-service                      N/A  →    ^4.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions