{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/9283","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/9283/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/9283/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/9283/events","html_url":"https://github.com/nodejs/node/pull/9283","id":185259414,"number":9283,"title":"module: fix loading from global folders on Windows","user":{"login":"richardlau","id":5445507,"avatar_url":"https://avatars.githubusercontent.com/u/5445507?v=3","gravatar_id":"","url":"https://api.github.com/users/richardlau","html_url":"https://github.com/richardlau","followers_url":"https://api.github.com/users/richardlau/followers","following_url":"https://api.github.com/users/richardlau/following{/other_user}","gists_url":"https://api.github.com/users/richardlau/gists{/gist_id}","starred_url":"https://api.github.com/users/richardlau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardlau/subscriptions","organizations_url":"https://api.github.com/users/richardlau/orgs","repos_url":"https://api.github.com/users/richardlau/repos","events_url":"https://api.github.com/users/richardlau/events{/privacy}","received_events_url":"https://api.github.com/users/richardlau/received_events","type":"User","site_admin":false},"labels":[{"id":273031171,"url":"https://api.github.com/repos/nodejs/node/labels/lts-watch-v4.x","name":"lts-watch-v4.x","color":"eb6420","default":false},{"id":463619724,"url":"https://api.github.com/repos/nodejs/node/labels/lts-watch-v6.x","name":"lts-watch-v6.x","color":"d93f0b","default":false},{"id":155435814,"url":"https://api.github.com/repos/nodejs/node/labels/module","name":"module","color":"fbca04","default":false},{"id":491152610,"url":"https://api.github.com/repos/nodejs/node/labels/notable-change","name":"notable-change","color":"f9d0c4","default":false},{"id":166236401,"url":"https://api.github.com/repos/nodejs/node/labels/windows","name":"windows","color":"9944dd","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-10-25T23:23:46Z","updated_at":"2016-12-15T03:49:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/9283","html_url":"https://github.com/nodejs/node/pull/9283","diff_url":"https://github.com/nodejs/node/pull/9283.diff","patch_url":"https://github.com/nodejs/node/pull/9283.patch"},"body":"##### Checklist\r\n- [x] `make -j8 test` (UNIX), or `vcbuild test nosign` (Windows) passes\r\n- [x] tests and/or benchmarks are included\r\n- [x] commit message follows commit guidelines\r\n##### Affected core subsystem(s)\r\n\r\nmodule\r\n##### Description of change\r\n\r\nAccording to [the `module` documentation](https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_loading_from_the_global_folders):\r\n\r\n```\r\nAdditionally, Node.js will search in the following locations:\r\n\r\n    1: $HOME/.node_modules\r\n    2: $HOME/.node_libraries\r\n    3: $PREFIX/lib/node\r\n\r\nWhere $HOME is the user's home directory, and $PREFIX is Node.js's configured node_prefix.\r\n```\r\n\r\nLoading from `$PREFIX/lib/node` is broken on Windows as the code is calculating  `$PREFIX/lib/node` \r\nrelative to `process.execPath`, but on Windows `process.execPath` is `$PREFIX\\node.exe` whereas everywhere else `process.execPath` is `$PREFIX/bin/node` (where `$PREFIX` is the root of the\r\ninstalled Node.js).\r\n\r\ne.g. If Node.js is in `c:\\node`, the code is adding `c:\\lib\\node` to the lookup path instead of `c:\\node\\lib\\node`:\r\n```\r\nC:\\node>set NODE_DEBUG=module\r\n\r\nC:\\node>node nosuchfile\r\nMODULE 12780: looking for \"C:\\\\node\\\\nosuchfile\" in [\"C:\\\\Users\\\\IBM_ADMIN\\\\.nod\r\ne_modules\",\"C:\\\\Users\\\\IBM_ADMIN\\\\.node_libraries\",\"C:\\\\lib\\\\node\"]\r\nmodule.js:472\r\n    throw err;\r\n    ^\r\n\r\nError: Cannot find module 'C:\\node\\nosuchfile'\r\n    at Function.Module._resolveFilename (module.js:470:15)\r\n    at Function.Module._load (module.js:418:25)\r\n    at Module.runMain (module.js:605:10)\r\n    at run (bootstrap_node.js:420:7)\r\n    at startup (bootstrap_node.js:139:9)\r\n    at bootstrap_node.js:535:3\r\n\r\nC:\\node>\r\n```"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/267231636","html_url":"https://github.com/nodejs/node/pull/9283#issuecomment-267231636","issue_url":"https://api.github.com/repos/nodejs/node/issues/9283","id":267231636,"user":{"login":"gibfahn","id":15943089,"avatar_url":"https://avatars.githubusercontent.com/u/15943089?v=3","gravatar_id":"","url":"https://api.github.com/users/gibfahn","html_url":"https://github.com/gibfahn","followers_url":"https://api.github.com/users/gibfahn/followers","following_url":"https://api.github.com/users/gibfahn/following{/other_user}","gists_url":"https://api.github.com/users/gibfahn/gists{/gist_id}","starred_url":"https://api.github.com/users/gibfahn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gibfahn/subscriptions","organizations_url":"https://api.github.com/users/gibfahn/orgs","repos_url":"https://api.github.com/users/gibfahn/repos","events_url":"https://api.github.com/users/gibfahn/events{/privacy}","received_events_url":"https://api.github.com/users/gibfahn/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T03:49:31Z","updated_at":"2016-12-15T03:49:31Z","body":"> This is a bugfix, but for the remote case someone was relying on the old behavior, should we make this semver-major?\r\n\r\nIt doesn't really seem possible to evaluate whether this will break people, so I guess yes."}}
{"actor":{"display_login":"gibfahn"}}