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

Issue with using vue-cli with private bitbucket repo #403

Closed
rwb7041 opened this issue Mar 16, 2017 · 14 comments
Closed

Issue with using vue-cli with private bitbucket repo #403

rwb7041 opened this issue Mar 16, 2017 · 14 comments

Comments

@rwb7041
Copy link

rwb7041 commented Mar 16, 2017

I've got a customized version of the webpack template that I'm using on my projects. Hosting it on a public github account works fine, but my organization has decided to go with private bitbucket repositories. I copied my github repository to bitbucket and went to test creating a new vue app with the cli and my bitbucket template with the following command:

vue init -c bitbucket:rwb7041/vuetemplate myproject

I get the following error:
vue-cli · Failed to download repo vuejs-templates/myproject: 'git clone' failed with status 128

So next I tried creating the myproject directory and running the following inside that directory:
vue init -c bitbucket:rwb7041/vuetemplate

And I got the following error (after responding 'Y' to the question of generating project in the current directory:
vue-cli · Local template "bitbucket:rwb7041/vuetemplate" not found.

I am using version 2.8.1 of the vue-cli. What am I doing incorrectly?

@znck
Copy link
Member

znck commented Mar 17, 2017

Unencrypted SSH key should be configured for git.

This is probably caused by missing ssh key or encrypted key asking for password or host mismatch.

@rwb7041
Copy link
Author

rwb7041 commented Mar 17, 2017

I believe part of my issue is that the version of vue-cli installed via npm does not have the changes referenced to in issue #355. I went ahead and cloned master and ran it again, and now I'm getting

vue-cli · Failed to download repo bitbucket:rwb7041/vuetemplate: 'git clone' failed with status 128

yet I can clone bitbucket:rwb7041/vuetemplate just fine with git

@rwb7041
Copy link
Author

rwb7041 commented Mar 17, 2017

After digging around more into what's going on, beyond the issue of the changes mentioned in #355 not being in the version npm installs, I've found the cause of my problem with 'git clone' failed with status 128. I'm on windows using Git Bash as my terminal, and the path being generated for where to clone the template is C:\Users\username\.vue-templates\bitbucket:rwb7041-vuetemplate. This path is an invalid path in Git Bash, and should be more like /c/Users/username/.vue-templates/....

@rwb7041
Copy link
Author

rwb7041 commented Mar 21, 2017

Is there any chance or timeline of when the version of the vue-cli installed by npm will be updated to include some of these changes (specifically the ones mentioned in #355 and fixed by #341)?

@zigomir
Copy link
Contributor

zigomir commented Mar 22, 2017

try npm install -g vuejs/vue-cli

@rwb7041
Copy link
Author

rwb7041 commented Mar 22, 2017

That seems to have done the trick. Thanks @zigomir. Still not sure why executing vue init -c bitbucket:rwb7041/vuetemplate myproject fails, but creating a myproject directory and running vue init -c bitbucket:rwb7041/vuetemplate from within the myproject directory works. I'm guessing a small problem with the command line arguments being picked up incorrectly maybe?

@rwb7041
Copy link
Author

rwb7041 commented Mar 22, 2017

So, npm install -g vuejs/vue-cli works on my MacBook, and appears to now work on my Windows machine in Git Bash, but i'm getting an error when it attempts to do the git clone which I'm thinking is the error I mentioned above about the path where it's trying to place the template being invalid in Git Bash (or mingw). Meanwhile, running vue init -c bitbucket:rwb7041/vuetemplate fails in the command prompt completely with the following:

C:\Users\rwb7041\AppData\Roaming\npm\node_modules\vue-cli\node_modules\rx-lite\rx.lite.js:75
throw e;
^

Error: write EINVAL
at exports._errnoException (util.js:1022:11)
at WriteStream.Socket._writeGeneric (net.js:715:26)
at WriteStream.Socket._write (net.js:734:8)
at doWrite (_stream_writable.js:334:12)
at writeOrBuffer (_stream_writable.js:320:5)
at WriteStream.Writable.write (_stream_writable.js:247:11)
at WriteStream.Socket.write (net.js:661:40)
at MuteStream.ondata (stream.js:31:26)
at emitOne (events.js:96:13)
at MuteStream.emit (events.js:188:7)
at MuteStream.write (C:\Users\rwb7041\AppData\Roaming\npm\node_modules\vue-cli\node_modules\mute-stream\mute.js:116:8)
at Object.exports.clearLine (C:\Users\rwb7041\AppData\Roaming\npm\node_modules\vue-cli\node_modules\inquirer\lib\utils\readline.js:50:13)
at module.exports.ScreenManager.clean (C:\Users\rwb7041\AppData\Roaming\npm\node_modules\vue-cli\node_modules\inquirer\lib\utils\screen-manager.js:92:8)
at module.exports.ScreenManager.render (C:\Users\rwb7041\AppData\Roaming\npm\node_modules\vue-cli\node_modules\inquirer\lib\utils\screen-manager.js:26:8)
at Prompt.render (C:\Users\rwb7041\AppData\Roaming\npm\node_modules\vue-cli\node_modules\inquirer\lib\prompts\confirm.js:85:15)
at Prompt._run (C:\Users\rwb7041\AppData\Roaming\npm\node_modules\vue-cli\node_modules\inquirer\lib\prompts\confirm.js:65:8)

@rwb7041
Copy link
Author

rwb7041 commented Mar 22, 2017

I'm seeing the exact behavior @unthunk describes on my MacBook, but I'd like to add 2 things for Windows.

  1. When running the vue cli commands in Git Bash (or mingw), the git clone attempts to store the template in C:\Users\username\.vue-templates which cause the clone to fail with a status of 128 because Git Bash will translate that as C:Usersusername.vue-templates`
  2. The other problem I'm seeing on Windows is when specifying a repository with the colon to indicate a particular host (i.e., bitbucket:owner/template), the directory that the git clone command tries to clone into is ~/.vue-templates/bitbucket:owner/repo. On Windows, file and folder names can't contain colons, so this cause the git clone to fail with a status of 128

Hopefully this makes sense and is enough to go on for a fix. Thanks

@dvic
Copy link

dvic commented Apr 4, 2017

I'm having the same problem on my Mac both with Github and Gitlab private repo's. Is there a way to have vue-cli output more debugging info?

@calvernaz
Copy link

I was having the same issue when using the full URL to the template. The short version seems to work just fine.

vue init calvernaz/vue-plugin-template tags-plugin

instead of

vue init https://github.com/calvernaz/vue-plugin-template tags-plugin

@scnich
Copy link

scnich commented May 4, 2017

Are there any updates regarding this?

Trying to "vue init" using a private bitbucket repo still doesn't work :(

@unthunk
Copy link

unthunk commented May 4, 2017

You can workaround by checking out your private template and installing from the lcoal copy:

vue init ~/fs/path/to-custom-template my-project

You will probably want to git pull on the local copy of the template before you vue init from it.

@steven-klein
Copy link

steven-klein commented May 5, 2017

@unthunk is correct about using the --clone flag. It's required when you are using private repo's which is noted in the download-git-repo readme.

@rwb7041 @scnich Additionally, take note that the shorthand notation for custom templates will not work in private repos either. Instead of bitbucket:username/repo use bitbucket.org:username/repo

Lastly, as @unthunk suggested, the first init using the --clone flag will work just fine. But subsequent usages will throw an error. This is because the directory already exists, and this appears to be coming from git-clone. So, you can either nuke the template cache:

rm -rf ~/.vue-templates

before each usage, which guarantees you get the latest version of your private repo, or you can clone it locally and install from the local path, or use the --offline flag to get the last cached template. In both cases you run the risk of using an out of date template.

vue init --offline bitbucket.org:username/repo --clone my-project

Documentation just need to reflect the requirement of the --clone flag for private repo's. The error where the cached template causes errors on subsequent uses might best be solved by fixing the caching issues in #409, by removing the cached template first, that error should be avoided.

@steven-klein
Copy link

Pull request #450 addresses removing existing template directories which resolves the issue where the subsequent clones of private repo's fail.

egoist pushed a commit that referenced this issue May 7, 2017
* clean cached template in downloadandgenerate

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

No branches or pull requests

8 participants