m0dch3n / vue-cli-plugin-cordova

Vue Cli 3 Cordova Plugin
MIT License
417 stars 63 forks source link

Admin rights for windows users #14

Closed riksnelders closed 6 years ago

riksnelders commented 6 years ago

Getting following error:

ERROR No platforms installed in "path here\src-cordova"

Things that might be wrong: folder is not created [ solved, run as administrator on windows] platforms are not added cause working directory not recognized as cordova based project

m0dch3n commented 6 years ago

I didn't test on windows, so your problem was solved by running the command as administrator on windows, because otherwise the folder is not created?

riksnelders commented 6 years ago

No, only the folder creation. Still getting the error that android is not installed as a platform

m0dch3n commented 6 years ago

If you have choosen "src-cordova" as path, you get this error, when src-cordova/platforms/android i.e doesn't exist...

Nevertheless, can you please copy paste me your console, when you do "vue add cordova" so I can see, if there is any special error message...

riksnelders commented 6 years ago

Ran vue add cordova in root project folder. Next to that, folder is created, but the platforms i selected are not added. thats the culprit. image

image

m0dch3n commented 6 years ago

currently I don't have windows, so I can't try by myself...

Nevertheless, please try the following steps:

Paste me the outputs here

m0dch3n commented 6 years ago

Then

Should work...

m0dch3n commented 6 years ago

Think i found the problem. If i run bash in my terminal, administrator rights are gone it seems. Ran it normally then platforms get added

Try in your bash, the cordova commands, maybe they need administrator rights...

riksnelders commented 6 years ago

Yes this does work!

Its the creating.. I ran as admin, with and without bash. Not all the files are being created. cuz platforms is empty now. but theres a platform folder.

m0dch3n commented 6 years ago

Yes this does work!

Its the creating.. I ran as admin, with and without bash. Not all the files are being created. cuz platforms is empty now. but theres a platform folder.

ok, can you please try manually the steps above, and paste the outputs...

riksnelders commented 6 years ago

image

m0dch3n commented 6 years ago

Interesting, it seems the administrator right problems, do not exist, if you run the commands manually...

As I said, I currently can't try on windows by myself, but maybe, you can the solve the problem, just:

This will invoke generator.js which itselfs executes the cordova commands...

To have more outout about the command, take a look in index.js

{
      cwd: srcCordovaPath,
      env: process.env,
      stdio: 'inherit', // pipe to console
      encoding: 'utf-8'
    })
riksnelders commented 6 years ago

I was running cordova 7.x.x That might cause it? I just updated. ill check back later

also notices when changing the baseDir of the projct in windows. this goes to c:/ if "/"

riksnelders commented 6 years ago

So far, the serve-android is not working.. the build version is working

m0dch3n commented 6 years ago

I replaced node's spawn with cross-spawn https://www.npmjs.com/package/cross-spawn

This should solve the admin and folder creation issues...

Can you please retry with 2.0.6 ?

riksnelders commented 6 years ago

Ill give it a go tomorrow. Thanks! 👌

m0dch3n commented 6 years ago

Ok, on the win 10, where I tested, everything worked fine, in the CMD console... However, I didn't try Bash under Windows

riksnelders commented 6 years ago

Hey. I just checked the serve-android. Its routing to the https:// version. So i need to be on local network with my device. and its not showing the actually APP If run from terminal it goes straight to app.

Havent got time to check the full install. but Im guessing, since the serve actually runs it works: )

m0dch3n commented 6 years ago

Hey. I just checked the serve-android. Its routing to the https:// version. So i need to be on local network with my device. and its not showing the actually APP If run from terminal it goes straight to app.

Havent got time to check the full install. but Im guessing, since the serve actually runs it works: )

very strange, on my machine it didn't use https and the serve command command should also ignore https, if you have this setting somewhere in your vue.config.js or .env, because I'm overriding it...

https://github.com/m0dch3n/vue-cli-plugin-cordova/blob/ead4fb181053d3f0167d44076b7467e5f6a3a67e/index.js#L132

riksnelders commented 6 years ago

Everything seems to be working now :)