Skip to content

Conversation

@rosen-vladimirov
Copy link
Contributor

pacote package does not work very well with relative paths, so ensure we pass full path to the extractPackage method. When trying to pass .tgz with relative path for template and the .tgz is located next to .git dir, the pacote package tries to download the repository instead of using the local .tgz package. Once full path is passed, it works correctly.

PR Checklist

What is the current behavior?

Follow the steps below and you'll receive an error:

  1. Clone any v2 template repo, for example https://github.com/rosen-vladimirov/test-tns-template-v2: git clone https://github.com/rosen-vladimirov/test-tns-template-v2
  2. Pack the template: cd test-tns-template-v2 && npm pack && cd .. - this will produce a test-tns-template-v2.tgz in test-tns-template-v2 dir.
  3. From any outside dir (not the test-tns-template-v2) try to create a new project by passing relative path to the .tgz: tns create myApp --template test-tns-template-v2/test-tns-template-v2.tgz
    The last operation will fail with error:
Error while executing:
/usr/local/bin/git ls-remote -h -t ssh://git@github.com/test-tns-template-v2/test-tns-template-v2-1.0.0.tgz.git

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

exited with error code: 128

What is the new behavior?

You can successfully create a project with the steps above

`pacote` package does not work very well with relative paths, so ensure we pass full path to the `extractPackage` method. When trying to pass `.tgz` with relative path for template and the `.tgz` is located next to `.git` dir, the `pacote` package tries to download the repository instead of using the local .tgz package. Once full path is passed, it works correctly.
@rosen-vladimirov rosen-vladimirov added this to the 4.2.0 milestone Aug 3, 2018
@rosen-vladimirov rosen-vladimirov self-assigned this Aug 3, 2018
@rosen-vladimirov rosen-vladimirov merged commit a10c2c5 into release Aug 3, 2018
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-proj-create-v2 branch August 3, 2018 11:23
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 this pull request may close these issues.

3 participants