{"action":"opened","issue":{"url":"https://api.github.com/repos/npm/npm/issues/12712","repository_url":"https://api.github.com/repos/npm/npm","labels_url":"https://api.github.com/repos/npm/npm/issues/12712/labels{/name}","comments_url":"https://api.github.com/repos/npm/npm/issues/12712/comments","events_url":"https://api.github.com/repos/npm/npm/issues/12712/events","html_url":"https://github.com/npm/npm/issues/12712","id":154927993,"number":12712,"title":"distinguish between local modules and global modules","user":{"login":"ORESoftware","id":11139560,"avatar_url":"https://avatars.githubusercontent.com/u/11139560?v=3","gravatar_id":"","url":"https://api.github.com/users/ORESoftware","html_url":"https://github.com/ORESoftware","followers_url":"https://api.github.com/users/ORESoftware/followers","following_url":"https://api.github.com/users/ORESoftware/following{/other_user}","gists_url":"https://api.github.com/users/ORESoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/ORESoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ORESoftware/subscriptions","organizations_url":"https://api.github.com/users/ORESoftware/orgs","repos_url":"https://api.github.com/users/ORESoftware/repos","events_url":"https://api.github.com/users/ORESoftware/events{/privacy}","received_events_url":"https://api.github.com/users/ORESoftware/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-15T20:19:00Z","updated_at":"2016-05-15T20:19:00Z","closed_at":null,"body":"I want to programmatically test if an NPM module is installed locally in a project, I have this\r\n\r\n```js\r\n  try {\r\n        //TODO: what if it recognizes global modules as well as local ones?\r\n        require.resolve('suman');\r\n    }\r\n    catch (e) {\r\n        err = e;\r\n    }\r\n```\r\n\r\nhowever, it appears that require.resolve also picks up global modules - is there a call I can use to just check for the existence of a locally installed module? Thanks\r\n"}}