{"action":"created","issue":{"url":"https://api.github.com/repos/npm/npm/issues/13547","repository_url":"https://api.github.com/repos/npm/npm","labels_url":"https://api.github.com/repos/npm/npm/issues/13547/labels{/name}","comments_url":"https://api.github.com/repos/npm/npm/issues/13547/comments","events_url":"https://api.github.com/repos/npm/npm/issues/13547/events","html_url":"https://github.com/npm/npm/issues/13547","id":168791383,"number":13547,"title":"Npm extract the wrong version of package","user":{"login":"lightPang","id":5879742,"avatar_url":"https://avatars.githubusercontent.com/u/5879742?v=3","gravatar_id":"","url":"https://api.github.com/users/lightPang","html_url":"https://github.com/lightPang","followers_url":"https://api.github.com/users/lightPang/followers","following_url":"https://api.github.com/users/lightPang/following{/other_user}","gists_url":"https://api.github.com/users/lightPang/gists{/gist_id}","starred_url":"https://api.github.com/users/lightPang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lightPang/subscriptions","organizations_url":"https://api.github.com/users/lightPang/orgs","repos_url":"https://api.github.com/users/lightPang/repos","events_url":"https://api.github.com/users/lightPang/events{/privacy}","received_events_url":"https://api.github.com/users/lightPang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-02T03:25:46Z","updated_at":"2016-09-16T19:31:05Z","closed_at":null,"body":"#### I'm opening this issue because:\r\n  - [x] npm is producing an incorrect install.\r\n\r\n#### What's going wrong?\r\n\r\nI'm using npm install to install mountebank, after I enter \"npm install mountebank -g\" in the command line window, the zip is successfully downloaded in npm-cache folder.\r\n\r\nHowever, when the install procedure continued, an error was thrown,\r\n\r\n Error extracting *\\AppData\\Roaming\\npm-cache\\mountebank\\1.5.0\\package.tgz archive: ENOENT: no such file or directory, open '*\\AppData\\Roaming\\npm-cache\\mountebank\\1.5.0\\package.tgz'\r\n\r\nI have confirmed that the latest mountebank version is \"1.5.1\", so it make me confused that npm tried extracting version 1.5.0.\r\n\r\nThe debug log is :\r\n\r\n48 silly addNameRange     '1.5.1-beta.1112',\r\n48 silly addNameRange     '1.5.1-beta.1114',\r\n48 silly addNameRange     '1.5.1-beta.1115' ] ]\r\n49 silly addNamed mountebank@1.5.1\r\n50 verbose addNamed \"1.5.1\" is a plain semver version for mountebank\r\n51 silly cache afterAdd mountebank@1.5.1\r\n52 verbose afterAdd *\\AppData\\Roaming\\npm-cache\\mountebank\\1.5.1\\package\\package.json not in flight; writing\r\n53 verbose afterAdd *\\AppData\\Roaming\\npm-cache\\mountebank\\1.5.1\\package\\package.json written\r\n54 silly rollbackFailedOptional Starting\r\n55 silly rollbackFailedOptional Finishing\r\n56 silly runTopLevelLifecycles Starting\r\n57 silly runTopLevelLifecycles Finishing\r\n58 silly install printInstalled\r\n59 verbose stack Error: Error extracting *\\AppData\\Roaming\\npm-cache\\mountebank\\1.5.0\\package.tgz archive: ENOENT: no such file or directory, open '*\\AppData\\Roaming\\npm-cache\\mountebank\\1.5.0\\package.tgz'\r\n59 verbose stack     at ReadStream.<anonymous> (*AppData\\Roaming\\npm\\node_modules\\npm\\lib\\fetch-package-metadata.js:268:10)\r\n59 verbose stack     at emitOne (events.js:77:13)\r\n59 verbose stack     at ReadStream.emit (events.js:169:7)\r\n59 verbose stack     at evalmachine.<anonymous>:1678:12\r\n59 verbose stack     at OpenReq.Req.done (*\\Roaming\\npm\\node_modules\\npm\\node_modules\\graceful-fs\\graceful-fs.js:141:5)\r\n59 verbose stack     at OpenReq.done (*\\Roaming\\npm\\node_modules\\npm\\node_modules\\graceful-fs\\graceful-fs.js:61:22)\r\n59 verbose stack     at FSReqWrap.oncomplete (evalmachine.<anonymous>:82:15)\r\n60 verbose cwd C:\\Users\\I321661\\Desktop\r\n61 error Windows_NT 10.0.10586\r\n62 error argv \"C:\\\\Program Files\\\\nodejs\\\\node.exe\" \"*\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js\" \"install\" \"-g\" \"mountebank\"\r\n63 error node v4.4.4\r\n64 error npm  v3.0.0\r\n65 error code EREADFILE\r\n66 error Error extracting *\\AppData\\Roaming\\npm-cache\\mountebank\\1.5.0\\package.tgz archive: ENOENT: no such file or directory, open '*\\AppData\\Roaming\\npm-cache\\mountebank\\1.5.0\\package.tgz'\r\n67 error If you need help, you may report this error at:\r\n67 error     <https://github.com/npm/npm/issues>\r\n68 verbose exit [ 1, true ]\r\n\r\n#### How can the CLI team reproduce the problem?\r\n\r\nnpm install mountebank -g\r\n\r\n### supporting information:\r\n\r\n - `npm -v` prints: 4.4.4\r\n - `node -v` prints: 3.0.0\r\n - `npm config get registry` prints: https://registry.npmjs.org/\r\n - Windows, OS X, or Linux?: Windows \r\n - Network issues:\r\n   - Geographic location where npm was run: China\r\n   - [x] I use a proxy to connect to the npm registry.\r\n   - [x] I use a proxy to connect to the web.\r\n   - [ ] I use a proxy when downloading Git repos.\r\n   - [ ] I access the npm registry via a VPN\r\n   - [ ] I don't use a proxy, but have limited or unreliable internet access.\r\n\r\n<!--\r\n    Thank you for contributing to npm! Please review this checklist\r\n    before submitting your issue.\r\n\r\n    - Please check if there's a solution in the troubleshooting wiki:\r\n      https://github.com/npm/npm/wiki/Troubleshooting\r\n\r\n    - Also ensure that your new issue conforms to npm's contribution guidelines:\r\n      https://github.com/npm/npm/wiki/Contributing-Guidelines\r\n\r\n    - Participation in this open source project is subject to the npm Code of Conduct:\r\n      https://www.npmjs.com/policies/conduct\r\n\r\n-->\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/npm/npm/issues/comments/247687151","html_url":"https://github.com/npm/npm/issues/13547#issuecomment-247687151","issue_url":"https://api.github.com/repos/npm/npm/issues/13547","id":247687151,"user":{"login":"bojand","id":2081100,"avatar_url":"https://avatars.githubusercontent.com/u/2081100?v=3","gravatar_id":"","url":"https://api.github.com/users/bojand","html_url":"https://github.com/bojand","followers_url":"https://api.github.com/users/bojand/followers","following_url":"https://api.github.com/users/bojand/following{/other_user}","gists_url":"https://api.github.com/users/bojand/gists{/gist_id}","starred_url":"https://api.github.com/users/bojand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bojand/subscriptions","organizations_url":"https://api.github.com/users/bojand/orgs","repos_url":"https://api.github.com/users/bojand/repos","events_url":"https://api.github.com/users/bojand/events{/privacy}","received_events_url":"https://api.github.com/users/bojand/received_events","type":"User","site_admin":false},"created_at":"2016-09-16T19:31:04Z","updated_at":"2016-09-16T19:31:04Z","body":"After digging into this some more... the package meta data has the following:\r\n\r\n```\r\n{ latest: '0.1.4-pre.0',\r\n     '0.1.2': '0.1.2',\r\n     '0.1.3': '0.1.3',\r\n     '0.1.4': '0.1.4' },\r\n```\r\n\r\nNot sure how `latest` got set to the pre version, one would assume 0.1.4 was published _after_ the 0.1.4-pre.\r\n\r\nIn `fetchNamedPackageData` we have\r\n\r\n\r\n```js\r\nfor (var ii = 0; ii < versions.length; ++ii) {\r\n          if (semver.gt(versions[ii], latestVersion)) continue\r\n          if (semver.satisfies(versions[ii], dep.spec)) {\r\n            return returnAndAddMetadata(pkg.versions[versions[ii]])\r\n          }\r\n        }\r\n```\r\n\r\n`versions` end up being `[ '0.1.4', '0.1.4-pre.0', '0.1.3', '0.1.2' ]`\r\nso the `latestVersion` version ends up being `'0.1.4-pre.0'` so 0.1.4 gets skipped over due to `gt` check.\r\n"}}
{"actor":{"display_login":"bojand"}}