apollo: Vue 3 - Error: You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists.

Describe the bug

vue add apollo fails with an error.

To Reproduce Steps to reproduce the behavior:

  1. create a simple app using vue 3 CLI
  2. cd into project folder
  3. type “vue add apollo”
  4. See error

Error message

📦  Installing vue-cli-plugin-apollo...

yarn add v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Saved 1 new dependency.
info Direct dependencies
└─ vue-cli-plugin-apollo@0.22.2
info All dependencies
└─ vue-cli-plugin-apollo@0.22.2
Done in 3.86s.
✔  Successfully installed plugin: vue-cli-plugin-apollo

? Add example code No
? Add a GraphQL API Server? No
? Configure Apollo Engine? No

🚀  Invoking generator for vue-cli-plugin-apollo...
 ERROR  Error: You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists.
Error: You cannot call "get" on a collection with no paths. Instead, check the "length" property first to verify at least 1 path exists.
    at Collection.get (/home/yadav/.nvm/versions/node/v12.19.0/lib/node_modules/@vue/cli/node_modules/jscodeshift/src/Collection.js:213:13)
    at injectOptions (/home/yadav/.nvm/versions/node/v12.19.0/lib/node_modules/@vue/cli/lib/util/codemods/injectOptions.js:15:6)
    at runTransformation (/home/yadav/.nvm/versions/node/v12.19.0/lib/node_modules/@vue/cli/node_modules/vue-codemod/dist/src/run-transformation.js:61:17)
    at /home/yadav/.nvm/versions/node/v12.19.0/lib/node_modules/@vue/cli/lib/Generator.js:290:23
    at Array.forEach (<anonymous>)
    at Generator.resolveFiles (/home/yadav/.nvm/versions/node/v12.19.0/lib/node_modules/@vue/cli/lib/Generator.js:276:24)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Generator.generate (/home/yadav/.nvm/versions/node/v12.19.0/lib/node_modules/@vue/cli/lib/Generator.js:175:5)
    at async runGenerator (/home/yadav/.nvm/versions/node/v12.19.0/lib/node_modules/@vue/cli/lib/invoke.js:111:3)
    at async invoke (/home/yadav/.nvm/versions/node/v12.19.0/lib/node_modules/@vue/cli/lib/invoke.js:92:3)

Versions vue: @vue/cli 4.5.10 “vue-cli-plugin-apollo”: “~0.22.2”,

Additional context Add any other context about the problem here.

package.json

{
  "name": "vue-ql",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "test:unit": "vue-cli-service test:unit",
    "test:e2e": "vue-cli-service test:e2e",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
  "devDependencies": {
    "@types/jest": "^24.0.19",
    "@typescript-eslint/eslint-plugin": "^2.33.0",
    "@typescript-eslint/parser": "^2.33.0",
    "@vue/cli-plugin-e2e-cypress": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-typescript": "~4.5.0",
    "@vue/cli-plugin-unit-jest": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vue/eslint-config-prettier": "^6.0.0",
    "@vue/eslint-config-typescript": "^5.0.2",
    "@vue/test-utils": "^2.0.0-0",
    "eslint": "^6.7.2",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-vue": "^7.0.0-0",
    "prettier": "^1.19.1",
    "stylus": "^0.54.7",
    "stylus-loader": "^3.0.2",
    "typescript": "~3.9.3",
    "vue-cli-plugin-apollo": "~0.22.2",
    "vue-jest": "^5.0.0-0"
  }
}

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 25
  • Comments: 15

Most upvoted comments

Same problem here

need help! same issue