{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/5684","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/5684/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/5684/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/5684/events","html_url":"https://github.com/nodejs/node/issues/5684","id":140502360,"number":5684,"title":"relative module paths resolve differently in REPL.","user":{"login":"jdalton","id":4303,"avatar_url":"https://avatars.githubusercontent.com/u/4303?v=3","gravatar_id":"","url":"https://api.github.com/users/jdalton","html_url":"https://github.com/jdalton","followers_url":"https://api.github.com/users/jdalton/followers","following_url":"https://api.github.com/users/jdalton/following{/other_user}","gists_url":"https://api.github.com/users/jdalton/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalton/subscriptions","organizations_url":"https://api.github.com/users/jdalton/orgs","repos_url":"https://api.github.com/users/jdalton/repos","events_url":"https://api.github.com/users/jdalton/events{/privacy}","received_events_url":"https://api.github.com/users/jdalton/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/confirmed-bug","name":"confirmed-bug","color":"fc2929"},{"url":"https://api.github.com/repos/nodejs/node/labels/path","name":"path","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-13T16:33:37Z","updated_at":"2016-03-13T20:34:50Z","closed_at":null,"body":"* **Version**: v5.5.0\r\n* **Platform**: Darwin jdalton.local 15.3.0 Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64\r\n\r\n```bash\r\nnpm init\r\n# <init a package>\r\nnpm i lodash --save\r\ntouch lodash.js\r\n```\r\nin lodash.js\r\n```js\r\nmodule.exports = {\r\n  'VERSION': 'should be me'\r\n};\r\n```\r\nNow in the REPL\r\n```js\r\nconsole.log(require('./lodash').VERSION);\r\n// => 4.6.1 instead of 'should be me'\r\n```\r\nPut the same code in a file\r\n```bash\r\ntouch foo.js\r\n```\r\nIn foo.js\r\n```js\r\nconsole.log(require('./lodash').VERSION);\r\n```\r\nthen\r\n```bash\r\nnode foo\r\n# logs 'should be me'\r\n```\r\nIt would work in the REPL if I changed the path from `'./lodash'` to `'./lodash.js'`."},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/196047437","html_url":"https://github.com/nodejs/node/issues/5684#issuecomment-196047437","issue_url":"https://api.github.com/repos/nodejs/node/issues/5684","id":196047437,"user":{"login":"watilde","id":1716463,"avatar_url":"https://avatars.githubusercontent.com/u/1716463?v=3","gravatar_id":"","url":"https://api.github.com/users/watilde","html_url":"https://github.com/watilde","followers_url":"https://api.github.com/users/watilde/followers","following_url":"https://api.github.com/users/watilde/following{/other_user}","gists_url":"https://api.github.com/users/watilde/gists{/gist_id}","starred_url":"https://api.github.com/users/watilde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watilde/subscriptions","organizations_url":"https://api.github.com/users/watilde/orgs","repos_url":"https://api.github.com/users/watilde/repos","events_url":"https://api.github.com/users/watilde/events{/privacy}","received_events_url":"https://api.github.com/users/watilde/received_events","type":"User","site_admin":false},"created_at":"2016-03-13T20:34:50Z","updated_at":"2016-03-13T20:34:50Z","body":"to place the node_modules paths below the . and not above, the part of the _resolveLookupPaths should be like the following?\r\n```diff\r\n- var mainPaths = ['.'].concat(modulePaths);\r\n- mainPaths = Module._nodeModulePaths('.').concat(mainPaths);\r\n+ var mainPaths = Module._nodeModulePaths('.').concat(mainPaths);\r\n+ mainPaths = ['.'].concat(modulePaths);\r\n```"}}