{"action":"created","issue":{"url":"https://api.github.com/repos/nodesecurity/nsp/issues/50","labels_url":"https://api.github.com/repos/nodesecurity/nsp/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/nodesecurity/nsp/issues/50/comments","events_url":"https://api.github.com/repos/nodesecurity/nsp/issues/50/events","html_url":"https://github.com/nodesecurity/nsp/issues/50","id":114964076,"number":50,"title":"Don't require package.json if I specify shrinkwrap","user":{"login":"pdehaan","id":557895,"avatar_url":"https://avatars.githubusercontent.com/u/557895?v=3","gravatar_id":"","url":"https://api.github.com/users/pdehaan","html_url":"https://github.com/pdehaan","followers_url":"https://api.github.com/users/pdehaan/followers","following_url":"https://api.github.com/users/pdehaan/following{/other_user}","gists_url":"https://api.github.com/users/pdehaan/gists{/gist_id}","starred_url":"https://api.github.com/users/pdehaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdehaan/subscriptions","organizations_url":"https://api.github.com/users/pdehaan/orgs","repos_url":"https://api.github.com/users/pdehaan/repos","events_url":"https://api.github.com/users/pdehaan/events{/privacy}","received_events_url":"https://api.github.com/users/pdehaan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodesecurity/nsp/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"nlf","id":424045,"avatar_url":"https://avatars.githubusercontent.com/u/424045?v=3","gravatar_id":"","url":"https://api.github.com/users/nlf","html_url":"https://github.com/nlf","followers_url":"https://api.github.com/users/nlf/followers","following_url":"https://api.github.com/users/nlf/following{/other_user}","gists_url":"https://api.github.com/users/nlf/gists{/gist_id}","starred_url":"https://api.github.com/users/nlf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlf/subscriptions","organizations_url":"https://api.github.com/users/nlf/orgs","repos_url":"https://api.github.com/users/nlf/repos","events_url":"https://api.github.com/users/nlf/events{/privacy}","received_events_url":"https://api.github.com/users/nlf/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-11-04T03:54:31Z","updated_at":"2016-01-27T00:19:36Z","closed_at":"2015-11-04T16:54:04Z","body":"I'm using the **gulp-nsp** module below, but I think this is more of a core **nsp** issue.\r\nI'm specifying a `shrinkwrap` object below via _npm-shrinkwrap.json_, but it gives me an error if I don't also specify the `package` object. It turns out, it only needs a `name` property in the `package` object, which it could easily get from the shrinkwrap file. I think if `shrinkwrap` is specified, then `package` should be optional.\r\n\r\n```sh\r\nvar gulp = require('gulp');\r\nvar gulpNSP = require('gulp-nsp');\r\n\r\nvar shrinkwrap = require('./npm-shrinkwrap.json');\r\n\r\n// To check your project\r\ngulp.task('nsp', function (done) {\r\n  gulpNSP({\r\n    // output: 'summary',\r\n    // package: require('./package.json'),\r\n    // package: {name: shrinkwrap.name},\r\n    shrinkwrap: shrinkwrap\r\n  }, done);\r\n});\r\n```\r\n\r\nOutput:\r\n```sh\r\n$ gulp nsp\r\n\r\n[19:52:30] Using gulpfile ~/dev/gulp-nsp-test/gulpfile.js\r\n[19:52:30] Starting 'nsp'...\r\n[19:52:30] 'nsp' errored after 3.99 ms\r\n[19:52:30] TypeError: Cannot read property 'length' of undefined\r\n    at /Users/pdehaan/dev/gulp-nsp-test/node_modules/gulp-nsp/index.js:27:45\r\n    at Object.module.exports [as check] (/Users/pdehaan/dev/gulp-nsp-test/node_modules/gulp-nsp/node_modules/nsp/lib/check.js:202:14)\r\n    at rsGulp (/Users/pdehaan/dev/gulp-nsp-test/node_modules/gulp-nsp/index.js:23:7)\r\n    at Gulp.<anonymous> (/Users/pdehaan/dev/gulp-nsp-test/gulpfile.js:8:3)\r\n    at module.exports (/Users/pdehaan/dev/gulp-nsp-test/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)\r\n    at Gulp.Orchestrator._runTask (/Users/pdehaan/dev/gulp-nsp-test/node_modules/gulp/node_modules/orchestrator/index.js:273:3)\r\n    at Gulp.Orchestrator._runStep (/Users/pdehaan/dev/gulp-nsp-test/node_modules/gulp/node_modules/orchestrator/index.js:214:10)\r\n    at Gulp.Orchestrator.start (/Users/pdehaan/dev/gulp-nsp-test/node_modules/gulp/node_modules/orchestrator/index.js:134:8)\r\n    at /Users/pdehaan/.npm-packages/lib/node_modules/gulp/bin/gulp.js:129:20\r\n    at process._tickCallback (node.js:355:11)\r\n```"},"comment":{"url":"https://api.github.com/repos/nodesecurity/nsp/issues/comments/175309269","html_url":"https://github.com/nodesecurity/nsp/issues/50#issuecomment-175309269","issue_url":"https://api.github.com/repos/nodesecurity/nsp/issues/50","id":175309269,"user":{"login":"nlf","id":424045,"avatar_url":"https://avatars.githubusercontent.com/u/424045?v=3","gravatar_id":"","url":"https://api.github.com/users/nlf","html_url":"https://github.com/nlf","followers_url":"https://api.github.com/users/nlf/followers","following_url":"https://api.github.com/users/nlf/following{/other_user}","gists_url":"https://api.github.com/users/nlf/gists{/gist_id}","starred_url":"https://api.github.com/users/nlf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlf/subscriptions","organizations_url":"https://api.github.com/users/nlf/orgs","repos_url":"https://api.github.com/users/nlf/repos","events_url":"https://api.github.com/users/nlf/events{/privacy}","received_events_url":"https://api.github.com/users/nlf/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T00:19:36Z","updated_at":"2016-01-27T00:19:36Z","body":"not really. this issue contains old information. how it works is this -\r\n\r\nif you provide only a package.json, we resolve that with the latest matching semver of each module that's currently installable. and check those.\r\n\r\nif you provide both package.json and npm-shrinkwrap.json, we do the same resolution, but instead of using the latest matching semver of every module, we try to find the module in the shrinkwrap and use the version noted there instead."}}