atom / apm

Atom Package Manager
https://atom.io/packages
MIT License
1.27k stars 296 forks source link

"apm list -b" and "apm i --packages-file" are incompatible with git packages #867

Open flavio-a opened 5 years ago

flavio-a commented 5 years ago

Prerequisites

Description

I'm trying to back up Atom installed packages with apm list -ib, and I expected the output of this command to be compatible with apm install --packages-file, but this isn't the case if there are git packages installed.

This issue is a lot like #833, but that's closed so I opened another one as stated here.

I would like to be able to do

apm list -ib > atom-packages.list

and then

apm install --packages-file atom-packages.list

but this produces an error when apm tries to install a git package.

Steps to Reproduce

  1. Install a git package: apm i GhostText/GhostText-for-Atom
  2. Create list file: apm list -ib > atom-packages.list This file now contains only the single line ghost-text@0.0.1
  3. Install packages listed: apm i --packages-file atom-packages.list

Expected behavior:

I expect it to smoothly install GhostText/GhostText-for-Atom.

Actual behavior:

It throws the following error:

$ apm i --packages-file atom-packages.list
Installing ghost-text@0.0.1 to ~/.atom/packages ✗
Request for package information failed: Not Found

Versions

$ apm --version
apm  2.4.3
npm  6.2.0
node 10.2.1 x64
atom 1.40.1
python 2.7.16
git 2.20.1

The system is Lubuntu 19.04, linux kernel 5.0.0-13-generic

rsese commented 4 years ago

Thanks for opening a new issue and for sharing those repro steps :+1: I can reproduce on macOS 10.14.6 with Atom 1.40.1. I temporarily reset to factory defaults and then followed your steps and see the same error though I'm still not sure why my attempt to reproduce using defunkt/zen didn't reproduce (/cc https://github.com/atom/apm/issues/833#issuecomment-488556826)?

flavio-a commented 4 years ago

I think the difference is that zen is actually a "normal" (I don't know the right name, sorry) package, ie. is listed on atom.io (https://atom.io/packages/zen) and the repo is for development or something, so you can actually install from it (it has version tags, so it also get the correct version) but when apm list -b outputs it you get a name that is found on atom.io

On the other hand ghost-text isn't listed (https://atom.io/packages/search?q=ghost-text), so apm can't find it.

Simply speaking: I can do apm i zen and it works, while apm i ghost-text doesn't.

Vagrantin commented 3 years ago

Hello I’m experiencing the same issue here. I’m using this functionality to be able to popup quickly new machine with my usual packages but it just doesn’t work. Is there any plan on doing something about it. The package install tool in the UI doesn’t use apm in the background ?

Thanks for the clarifications.

Vagrantin commented 3 years ago

Maybe a some details of my issue would help here

My issue

I’m exporting the list of my packages with : apm ls --installed --bare > my-packages.txt output:

atom-beautify@0.33.4 atom-package-sync@0.4.0 atom-python-run@0.9.7 atom-wrap-in-tag@0.6.0 autocompiler-pug-jade@2.0.1 autocomplete-python@1.16.0 highlight-colors@0.9.0 language-autohotkey2@1.0.1 language-groovy@0.7.0 language-markdown@0.37.0 language-powershell@5.0.0 language-pug@0.0.22 linter-pug@2.0.14 lorem@4.0.0 markdown-pdf@2.3.3 markdown-to-html@0.5.0 markdown-writer@2.11.10 open-in-browser@0.5.2 platformio-ide-terminal@2.10.0 python-indent@1.2.6 script@3.26.0 source-preview@0.5.3 source-preview-pug@0.2.0 split-diff@1.6.1 Sublime-Style-Column-Selection@1.7.5

then try to install this list with: apm i --package-file my-packages.txt I’m getting after few second of process running: Installing modules done And I don’t have any modules installed…

My current workaround with Powershell,

Is to clean up my-packages.txt ((Get-Content -path my-packages.txt -Raw) -replace '@(.*)','') | Set-Content -Path my-packages.txt to get this

atom-beautify atom-package-sync atom-python-run atom-wrap-in-tag autocompiler-pug-jade autocomplete-python highlight-colors language-autohotkey2 language-groovy language-markdown language-powershell language-pug linter-pug lorem markdown-pdf markdown-to-html markdown-writer open-in-browser platformio-ide-terminal python-indent script source-preview source-preview-pug split-diff Sublime-Style-Column-Selection

Then install with apm i by reading line by line the content of the file

foreach($line in Get-Content $env:HOMEPATH\.atom\my-packages.txt) {
    apm i $line
}