1
votes

system info:

  • @vue/cli-service: 4.5.9,
  • vue: 2.6.12,

issue reproduce steps: execute cmd: $ vue add cordova

result:

Installing vue-cli-plugin-cordova...

yarn add v1.22.5

[1/4] Resolving packages...

[2/4] Fetching packages...

info [email protected]: The platform "win32" is incompatible with this module.

info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.

info [email protected]: The platform "win32" is incompatible with this module.

info "[email protected]" 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 └─ [email protected]

info All dependencies └─ [email protected]

$ npm run build

[email protected] build D:\Repos\NUS\NUS FE

vue-cli-service build

ERROR TypeError: Cannot read property 'cordovaPath' of undefined

TypeError: Cannot read property 'cordovaPath' of undefined

at module.exports (D:\Repos\NUS\NUS FE\node_modules\vue-cli-plugin-cordova\index.js:29:45)

at D:\Repos\NUS\NUS FE\node_modules\@vue\cli-service\lib\Service.js:78:7

at Array.forEach (<anonymous>)

at Service.init (D:\Repos\NUS\NUS FE\node_modules\@vue\cli-service\lib\Service.js:76:18)

at Service.run (D:\Repos\NUS\NUS FE\node_modules\@vue\cli-service\lib\Service.js:215:10)

at Object.<anonymous> (D:\Repos\NUS\NUS FE\node_modules\@vue\cli-service\bin\vue-cli-service.js:36:9)

at Module._compile (internal/modules/cjs/loader.js:1137:30)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)

at Module.load (internal/modules/cjs/loader.js:985:32)

at Function.Module._load (internal/modules/cjs/loader.js:878:14)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! [email protected] build: vue-cli-service build

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the [email protected] build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

npm ERR! C:\Users\navu\AppData\Roaming\npm-cache_logs\2020-12-11T08_19_10_099Z-debug.log

enter image description here

Has anyone got an issue like this or know the resolved solution? Thanks in advance!

1

1 Answers

0
votes

I just had the same problem here. I solved by adding the following on the vue.config.js file:

pluginOptions: {
  cordovaPath: 'src-cordova'
}

Example file with addition:

module.exports = {
  publicPath: '',
  pluginOptions: {
    cordovaPath: 'src-cordova'
  }
}

I got this by reading this topic: Default install of vue-cli-plugin-cordova will not run on ios simulator