{"action":"created","issue":{"url":"https://api.github.com/repos/creationix/nvm/issues/1120","repository_url":"https://api.github.com/repos/creationix/nvm","labels_url":"https://api.github.com/repos/creationix/nvm/issues/1120/labels{/name}","comments_url":"https://api.github.com/repos/creationix/nvm/issues/1120/comments","events_url":"https://api.github.com/repos/creationix/nvm/issues/1120/events","html_url":"https://github.com/creationix/nvm/issues/1120","id":161000120,"number":1120,"title":"Need of consistent version value to be referenced by other scripts","user":{"login":"Tomino2112","id":1140217,"avatar_url":"https://avatars.githubusercontent.com/u/1140217?v=3","gravatar_id":"","url":"https://api.github.com/users/Tomino2112","html_url":"https://github.com/Tomino2112","followers_url":"https://api.github.com/users/Tomino2112/followers","following_url":"https://api.github.com/users/Tomino2112/following{/other_user}","gists_url":"https://api.github.com/users/Tomino2112/gists{/gist_id}","starred_url":"https://api.github.com/users/Tomino2112/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tomino2112/subscriptions","organizations_url":"https://api.github.com/users/Tomino2112/orgs","repos_url":"https://api.github.com/users/Tomino2112/repos","events_url":"https://api.github.com/users/Tomino2112/events{/privacy}","received_events_url":"https://api.github.com/users/Tomino2112/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-18T01:23:35Z","updated_at":"2016-06-18T15:32:37Z","closed_at":null,"body":"Versions are a bit all over the place now once you try to get them from outside of nvm. \r\n\r\n`nvm install 6`\r\n\r\n`node -v` gives you `v6.2.1`\r\n`.nvm/alias/default` gives you `6`\r\nIn path to node itself is `v6.2.1`\r\n\r\nWe need some definite way for custom scripts to determine what is the current version and the patht o executable/libraries.\r\n\r\nNormally I could do `NODE_VERSION=$(node -v)` but in some scripts (and I came across them quite a lot) you need to get the version even before `nvm` is available. \r\n\r\nIn that case I do: \r\n```\r\nNODE_VERSION=`cat /home/${USER}/.nvm/alias/default` \r\n```\r\n\r\nUnfortunately I get `6` and there is no way for me to reference executable and global libraries. This particular example is an upstart script. At the point of getting the node version we dont have `nvm` yet and at the point where we have nvm, its too late (need to be referenced earlier)"},"comment":{"url":"https://api.github.com/repos/creationix/nvm/issues/comments/226948523","html_url":"https://github.com/creationix/nvm/issues/1120#issuecomment-226948523","issue_url":"https://api.github.com/repos/creationix/nvm/issues/1120","id":226948523,"user":{"login":"ljharb","id":45469,"avatar_url":"https://avatars.githubusercontent.com/u/45469?v=3","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"created_at":"2016-06-18T15:32:37Z","updated_at":"2016-06-18T15:32:37Z","body":"You shouldn't ever need to read alias files yourself. `nvm alias default` will also give you `6`, fwiw, and `nvm version 6` would give you `v6.2.1`.\r\n\r\nSince `nvm` alias files and `.nvmrc` files accept version numbers in a custom `nvm` format, without `nvm` available, there does not exist a clean or reliable way to convert that into node's standard version number."}}
{"actor":{"display_login":"ljharb"}}