{"action":"opened","issue":{"url":"https://api.github.com/repos/substack/node-resolve/issues/78","labels_url":"https://api.github.com/repos/substack/node-resolve/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/substack/node-resolve/issues/78/comments","events_url":"https://api.github.com/repos/substack/node-resolve/issues/78/events","html_url":"https://github.com/substack/node-resolve/issues/78","id":63334161,"number":78,"title":"Relative basedir on windows fails to resolve anything","user":{"login":"Joris-van-der-Wel","id":745898,"avatar_url":"https://avatars.githubusercontent.com/u/745898?v=3","gravatar_id":"","url":"https://api.github.com/users/Joris-van-der-Wel","html_url":"https://github.com/Joris-van-der-Wel","followers_url":"https://api.github.com/users/Joris-van-der-Wel/followers","following_url":"https://api.github.com/users/Joris-van-der-Wel/following{/other_user}","gists_url":"https://api.github.com/users/Joris-van-der-Wel/gists{/gist_id}","starred_url":"https://api.github.com/users/Joris-van-der-Wel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Joris-van-der-Wel/subscriptions","organizations_url":"https://api.github.com/users/Joris-van-der-Wel/orgs","repos_url":"https://api.github.com/users/Joris-van-der-Wel/repos","events_url":"https://api.github.com/users/Joris-van-der-Wel/events{/privacy}","received_events_url":"https://api.github.com/users/Joris-van-der-Wel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-20T23:58:33Z","updated_at":"2015-03-20T23:58:33Z","closed_at":null,"body":"The following will fail (windows 8.1):\r\n\r\n```javascript\r\nvar path = require('resolve').sync(\r\n        'resolve/test/core.js',\r\n        {\r\n                basedir: 'lib\\\\foo'\r\n        }\r\n);\r\n// Error: Cannot find module 'resolve/test/core.js' from 'lib\\foo'\r\n```\r\n\r\nHowever, it works properly if I do the following instead:\r\n```javascript\r\nvar path = require('resolve').sync(\r\n        'resolve/test/core.js',\r\n        {\r\n                basedir: require('path').resolve('lib\\\\foo')\r\n        }\r\n);\r\n// D:\\Users\\joris_000\\Projects\\foo\\node_modules\\resolve\\test\\core.js\r\n```\r\n\r\nIt looks like something is going wrong here: [node-modules-paths.js:8](https://github.com/substack/node-resolve/blob/9d6b7af28c054676d6ea8a5037353ed750ea13bb/lib/node-modules-paths.js#L8)\r\n\r\nIf I log the paths that are being created at [line 26](https://github.com/substack/node-resolve/blob/9d6b7af28c054676d6ea8a5037353ed750ea13bb/lib/node-modules-paths.js#L26), I get the following output:\r\n```\r\n/D:\\Users\\joris_000\\Documents\\Projects\\foo\\lib\\foo\\node_modules\r\n/D:\\Users\\joris_000\\Documents\\Projects\\foo\\lib\\node_modules\r\n/D:\\Users\\joris_000\\Documents\\Projects\\foo\\node_modules\r\n/D:\\Users\\joris_000\\Documents\\Projects\\node_modules\r\n/D:\\Users\\joris_000\\Documents\\node_modules\r\n/D:\\Users\\joris_000\\node_modules\r\n/D:\\Users\\node_modules\r\n/D:node_modules\r\n```\r\nIf I move line 18 before line 8, so that the end result is this:\r\n```javascript\r\nmodule.exports = function (start, opts) {\r\n    var modules = opts.moduleDirectory\r\n        ? [].concat(opts.moduleDirectory)\r\n        : ['node_modules']\r\n    ;\r\n\r\n    start = path.resolve(start);\r\n\r\n    var prefix = '/';\r\n    if (/^([A-Za-z]:)/.test(start)) {\r\n        prefix = '';\r\n    } else if (/^\\\\\\\\/.test(start)) {\r\n        prefix = '\\\\\\\\';\r\n    }\r\n    var splitRe = process.platform === 'win32' ? /[\\/\\\\]/ : /\\/+/;\r\n\r\n    // ensure that `start` is an absolute path at this point,\r\n    // resolving againt the process' current working directory\r\n    var parts = start.split(splitRe);\r\n...\r\n```\r\nIt seems to be fixed, but I am not sure how this change affects other platforms"}}