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

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

Closed
franciscolourenco opened this issue Oct 31, 2019 · 1 comment · Fixed by #4859
Closed
Labels

Comments

@franciscolourenco
Copy link

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
@haoqunjiang haoqunjiang added the bug label Nov 1, 2019
@hcwhan
Copy link

hcwhan commented Nov 18, 2019

I am experiencing the same problem
check Codes
because function getInstalledVersion is read path.resolve(this.context, 'node_modules', packageName) package.json
so before vue upgrade you can do npm install or yarn install , it's work

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

Successfully merging a pull request may close this issue.

3 participants