How to require an Atom version in package.json


#1

One of my packages, subword-navigation, had a deprecated method. The latest version of my package requires Atom v0.145. I tried to specify the Atom version in the package.json file. But, when I download the package on my machine running Atom 0.144.0, I get the latest version of the package, not the previous version.

Here’s my package.json:

{
  "name": "subword-navigation",
  "main": "./lib/main",
  "version": "2.0.0",
  "description": "Navigate camelCase and snake_case words",
  "activationEvents": [],
  "repository": {
    "type": "git",
    "url": "https://github.com/dsandstrom/atom-subword-navigation"
  },
  "bugs": {
    "url": "https://github.com/dsandstrom/atom-subword-navigation/issues"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "https://github.com/dsandstrom/atom-ruby-block-converter/raw/master/LICENSE.md"
    }
  ],
  "engines": {
    "atom": ">= 0.145.0"
  },
  "devDependencies": {
    "fs-plus": "2.x",
    "temp": "~0.6.0"
  },
  "dependencies": {
    "underscore-plus": "1.x"
  }
}

#2

I believe there is already an issue open on this on the apm package. I can’t check right now, but I’ll look for it when I get home.


#3

Thanks. Here it is: https://github.com/atom/apm/issues/169


#4

If I use apm, it installs the old version of my package. If I use settings-view, it installs the latest. So it must be a bug with settings-view.


#5

That’s weird. Underneath it all, Settings View should be using apm.


#6

Are you (or have you ever) running built Atom from source? Reason I ask, is that perhaps your apm symlink is pointing to an old, outdated version of Atom and thus getting the incorrect version information.

Assuming you are not on Windows, what is the output of executing readlink $(which apm)? On my system it outputs

/Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm

Using that path, we can check the version of Atom that symlinked apm points to be doing e.g.

/Applications/Atom.app/Contents/Resources/app/atom.sh --version

#7

No, I’m not, nor have I ever built Atom from source. It wasn’t me, I swear :wink:

I was testing at work on a Mac. And I can’t really test the same situation because I couldn’t wait any longer to update. Apm was doing the right thing, installing the old version of the package. But settings-view, on a new install of the package, was installing the latest version of the package, which wasn’t compatible with Atom v0.144. However, Atom was downloading an update. Maybe, two. Because I was never able to install v0.145, it installed v0.146 instead. So maybe v0.145 was downloaded already and that could have confused settings-view.

But for completeness:

~                                                                                               
▶ readlink $(which apm)
/Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm

~                                                                                                  
▶ /Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm --version
apm  0.111.0
npm  1.4.4
node 0.10.33
python 2.7.5
git 2.1.3

I will try to upload a dummy package to see if I can reproduce the problem.