{"action":"created","issue":{"url":"https://api.github.com/repos/TryGhost/Ghost/issues/7097","repository_url":"https://api.github.com/repos/TryGhost/Ghost","labels_url":"https://api.github.com/repos/TryGhost/Ghost/issues/7097/labels{/name}","comments_url":"https://api.github.com/repos/TryGhost/Ghost/issues/7097/comments","events_url":"https://api.github.com/repos/TryGhost/Ghost/issues/7097/events","html_url":"https://github.com/TryGhost/Ghost/pull/7097","id":165755264,"number":7097,"title":"Node version check w/o semver","user":{"login":"ErisDS","id":101513,"avatar_url":"https://avatars.githubusercontent.com/u/101513?v=3","gravatar_id":"","url":"https://api.github.com/users/ErisDS","html_url":"https://github.com/ErisDS","followers_url":"https://api.github.com/users/ErisDS/followers","following_url":"https://api.github.com/users/ErisDS/following{/other_user}","gists_url":"https://api.github.com/users/ErisDS/gists{/gist_id}","starred_url":"https://api.github.com/users/ErisDS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ErisDS/subscriptions","organizations_url":"https://api.github.com/users/ErisDS/orgs","repos_url":"https://api.github.com/users/ErisDS/repos","events_url":"https://api.github.com/users/ErisDS/events{/privacy}","received_events_url":"https://api.github.com/users/ErisDS/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"kirrg001","id":1160712,"avatar_url":"https://avatars.githubusercontent.com/u/1160712?v=3","gravatar_id":"","url":"https://api.github.com/users/kirrg001","html_url":"https://github.com/kirrg001","followers_url":"https://api.github.com/users/kirrg001/followers","following_url":"https://api.github.com/users/kirrg001/following{/other_user}","gists_url":"https://api.github.com/users/kirrg001/gists{/gist_id}","starred_url":"https://api.github.com/users/kirrg001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirrg001/subscriptions","organizations_url":"https://api.github.com/users/kirrg001/orgs","repos_url":"https://api.github.com/users/kirrg001/repos","events_url":"https://api.github.com/users/kirrg001/events{/privacy}","received_events_url":"https://api.github.com/users/kirrg001/received_events","type":"User","site_admin":false},"assignees":[{"login":"kirrg001","id":1160712,"avatar_url":"https://avatars.githubusercontent.com/u/1160712?v=3","gravatar_id":"","url":"https://api.github.com/users/kirrg001","html_url":"https://github.com/kirrg001","followers_url":"https://api.github.com/users/kirrg001/followers","following_url":"https://api.github.com/users/kirrg001/following{/other_user}","gists_url":"https://api.github.com/users/kirrg001/gists{/gist_id}","starred_url":"https://api.github.com/users/kirrg001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirrg001/subscriptions","organizations_url":"https://api.github.com/users/kirrg001/orgs","repos_url":"https://api.github.com/users/kirrg001/repos","events_url":"https://api.github.com/users/kirrg001/events{/privacy}","received_events_url":"https://api.github.com/users/kirrg001/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-07-15T10:19:24Z","updated_at":"2016-07-15T11:09:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/TryGhost/Ghost/pulls/7097","html_url":"https://github.com/TryGhost/Ghost/pull/7097","diff_url":"https://github.com/TryGhost/Ghost/pull/7097.diff","patch_url":"https://github.com/TryGhost/Ghost/pull/7097.patch"},"body":"This PR is an attempt to reduce the amount of friction users have with installing Ghost.\r\n\r\nThe other option rather than doing this would be simply to remove this check.\r\n\r\nUnfortunately, different versions of `npm` all handle `preinstall` quite differently. The order of operations are completely different between npm@2 and npm@3. Further still, using `npm install` inside of a `preinstall` script runs into permissions issues frequently.\r\n\r\nThis PR removes the need for npm installing `semver` and also removes the require of `package.json` from the check that is run during the preinstall.\r\n\r\nI'm then using a very simple strategy to attempt to match the current node version with one of the version strings in `package.json#engines`:\r\n\r\n- clean up the node version string to be just the first two digits: `x.x` - major & minor, as these are the only ones we ever want to match against.\r\n- for each version in engines:\r\n    - detect the first char as `~` or `^` as we have to do different matches for these\r\n    - also simplify the string to major & minor\r\n    - for ~ check the strings are identical (0.10 or 0.12)\r\n    - for ^ check the first number is the same (4) and the second number is the same or greater (2+)\r\n\r\nThis should also work when we remove `~0.10.0` and add `^6.??.0` in October.\r\n\r\nI have tested this on my mac using both npm@2 and npm@3. I have tested both running `npm install` inside Ghost, and proxied testing `npm install ghost` by using a local package as described [here](http://podefr.tumblr.com/post/30488475488/locally-test-your-npm-modules-without-publishing).\r\n\r\nI don't really know how to replicate the issues which result in the error `npm WARN cannot run in wd` - these are usually to do with needing sudo or some other permission issue?\r\n\r\nIf anyone has an idea what to test to see if this code is less painful, I'd be grateful.\r\n\r\n\r\n-----\r\n\r\ncloses #6691\r\n\r\n- removes dependency on semver & package.json in preinstall script\r\n- has a simplified proxy of semver to look for the right version numbers"},"comment":{"url":"https://api.github.com/repos/TryGhost/Ghost/issues/comments/232924542","html_url":"https://github.com/TryGhost/Ghost/pull/7097#issuecomment-232924542","issue_url":"https://api.github.com/repos/TryGhost/Ghost/issues/7097","id":232924542,"user":{"login":"kirrg001","id":1160712,"avatar_url":"https://avatars.githubusercontent.com/u/1160712?v=3","gravatar_id":"","url":"https://api.github.com/users/kirrg001","html_url":"https://github.com/kirrg001","followers_url":"https://api.github.com/users/kirrg001/followers","following_url":"https://api.github.com/users/kirrg001/following{/other_user}","gists_url":"https://api.github.com/users/kirrg001/gists{/gist_id}","starred_url":"https://api.github.com/users/kirrg001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirrg001/subscriptions","organizations_url":"https://api.github.com/users/kirrg001/orgs","repos_url":"https://api.github.com/users/kirrg001/repos","events_url":"https://api.github.com/users/kirrg001/events{/privacy}","received_events_url":"https://api.github.com/users/kirrg001/received_events","type":"User","site_admin":false},"created_at":"2016-07-15T11:09:37Z","updated_at":"2016-07-15T11:09:37Z","body":"i like this improvement. i've tested so far with `npm2` and several combinations, couldn't break it. will try on `npm3` soon."}}
{"actor":{"display_login":"kirrg001"}}