{"action":"created","issue":{"url":"https://api.github.com/repos/balderdashy/sails/issues/3639","repository_url":"https://api.github.com/repos/balderdashy/sails","labels_url":"https://api.github.com/repos/balderdashy/sails/issues/3639/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/sails/issues/3639/comments","events_url":"https://api.github.com/repos/balderdashy/sails/issues/3639/events","html_url":"https://github.com/balderdashy/sails/issues/3639","id":138775251,"number":3639,"title":"Using angular2 sails module loader tries to load template package.json files","user":{"login":"soletan","id":48088,"avatar_url":"https://avatars.githubusercontent.com/u/48088?v=3","gravatar_id":"","url":"https://api.github.com/users/soletan","html_url":"https://github.com/soletan","followers_url":"https://api.github.com/users/soletan/followers","following_url":"https://api.github.com/users/soletan/following{/other_user}","gists_url":"https://api.github.com/users/soletan/gists{/gist_id}","starred_url":"https://api.github.com/users/soletan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soletan/subscriptions","organizations_url":"https://api.github.com/users/soletan/orgs","repos_url":"https://api.github.com/users/soletan/repos","events_url":"https://api.github.com/users/soletan/events{/privacy}","received_events_url":"https://api.github.com/users/soletan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/balderdashy/sails/labels/Needs%20cleanup","name":"Needs cleanup","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-06T09:44:25Z","updated_at":"2016-03-06T10:46:46Z","closed_at":"2016-03-06T09:44:36Z","body":"I'm trying to develop an angular2-based application with sails but can't even get the JS-based Hello-World-example to work. When I start service I get this:\r\n\r\n```\r\nerror: SyntaxError: C:\\myApp\\node_modules\\angular2\\ts\\package.json: Unexpected token <\r\n    at Object.parse (native)\r\n    at Object.Module._extensions..json (module.js:450:27)\r\n    at Module.load (module.js:356:32)\r\n    at Function.Module._load (module.js:313:12)\r\n    at Module.require (module.js:366:17)\r\n    at require (module.js:385:17)\r\n    at C:\\myRoaming\\npm\\node_modules\\sails\\node_modules\\include-all\\index.js:131:29\r\n    at Array.forEach (native)\r\n    at requireAll (C:\\myRoaming\\npm\\node_modules\\sails\\node_modules\\include-all\\index.js:46:9)\r\n    at C:\\myRoaming\\npm\\node_modules\\sails\\node_modules\\include-all\\index.js:56:23 [SyntaxError: C:\\myApp\\node_modules\\angular2\\ts\\package.json: Unexpected token <]\r\n```\r\n\r\nI tried to find out code causing this and found this:\r\n\r\n```javascript\r\n    loadUserHooks: function (cb) {\r\n\r\n      async.auto({\r\n[..]\r\n        // Load package.json files from node_modules to check for hooks\r\n        nodeModulesFolder: function(cb) {\r\n          buildDictionary.optional({\r\n            dirname: path.resolve(sails.config.appPath, 'node_modules'),\r\n            filter: /^(package\\.json)$/,\r\n            excludeDirs: /^\\./,\r\n            depth: 3\r\n          }, cb);\r\n        }\r\n      }, [..]\r\n    },\r\n```\r\n\r\nin `node_modules/sails/lib/hooks/moduleloader/index.js`.\r\n\r\nObviously this code is slightly to greedy in this case for it is trying to read a template package.json file of angular2's TypeScript version. And obviously there is no intended opportunity with sails to have custom options for influencing the system here. I totally accept the _convention over configuration_ approach, but it fails when its processing 3rd party libraries that greedy and generically. \r\n\r\nIs it possible to \r\n\r\n1. either provide filtering callback in configuration for choosing matches to obey or \r\n2. limit search for package.json files to the root folder of every direct dependency, that `node_modules/*/package.json` rather than `node_modules/**/package.json`?\r\n\r\nHere are my projects dependencies as declared in my package.json, _not the one that was failing_:\r\n\r\n```json\r\n{\r\n  \"dependencies\": {\r\n    \"angular2\": \"^2.0.0-beta.8\",\r\n    \"bluebird\": \"^3.3.3\",\r\n    \"ejs\": \"2.3.4\",\r\n    \"es6-promise\": \"^3.0.2\",\r\n    \"es6-shim\": \"^0.33.3\",\r\n    \"grunt\": \"0.4.5\",\r\n    \"grunt-contrib-clean\": \"0.6.0\",\r\n    \"grunt-contrib-coffee\": \"0.13.0\",\r\n    \"grunt-contrib-concat\": \"0.5.1\",\r\n    \"grunt-contrib-copy\": \"0.5.0\",\r\n    \"grunt-contrib-cssmin\": \"0.9.0\",\r\n    \"grunt-contrib-jst\": \"0.6.0\",\r\n    \"grunt-contrib-less\": \"1.1.0\",\r\n    \"grunt-contrib-uglify\": \"0.7.0\",\r\n    \"grunt-contrib-watch\": \"0.5.3\",\r\n    \"grunt-sails-linker\": \"~0.10.1\",\r\n    \"grunt-sync\": \"0.2.4\",\r\n    \"include-all\": \"~0.1.6\",\r\n    \"jade\": \"^1.11.0\",\r\n    \"lodash\": \"^4.5.1\",\r\n    \"passport\": \"^0.3.2\",\r\n    \"rc\": \"1.0.1\",\r\n    \"reflect-metadata\": \"^0.1.2\",\r\n    \"rxjs\": \"^5.0.0-beta.2\",\r\n    \"sails\": \"~0.12.1\",\r\n    \"sails-disk\": \"^0.10.9\",\r\n    \"zone.js\": \"^0.5.15\"\r\n  },\r\n  \"scripts\": {\r\n    \"debug\": \"node debug app.js\",\r\n    \"start\": \"node app.js\"\r\n  },\r\n  \"main\": \"app.js\",\r\n  \"license\": \"\"\r\n}\r\n```\r\n\r\nUpdate. Great bot, guess I won't report issues or feature requests to your project quite frequently ... got my first negative impression on sailsjs, what a pity ... why not provide a tool in sails for generating all this stuff?\r\n\r\nSails-version: 0.12.1 (though it's written in excerpt of package.json)\r\nNode-version: 4.2.4 (though it isn't related to this issue)\r\nNPM-version: 3.7.2 (though it isn't affecting this issue either)\r\nOS: Windows (as you can see in excerpts above, and though it isn't affecting this issue either)"},"comment":{"url":"https://api.github.com/repos/balderdashy/sails/issues/comments/192870078","html_url":"https://github.com/balderdashy/sails/issues/3639#issuecomment-192870078","issue_url":"https://api.github.com/repos/balderdashy/sails/issues/3639","id":192870078,"user":{"login":"soletan","id":48088,"avatar_url":"https://avatars.githubusercontent.com/u/48088?v=3","gravatar_id":"","url":"https://api.github.com/users/soletan","html_url":"https://github.com/soletan","followers_url":"https://api.github.com/users/soletan/followers","following_url":"https://api.github.com/users/soletan/following{/other_user}","gists_url":"https://api.github.com/users/soletan/gists{/gist_id}","starred_url":"https://api.github.com/users/soletan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soletan/subscriptions","organizations_url":"https://api.github.com/users/soletan/orgs","repos_url":"https://api.github.com/users/soletan/repos","events_url":"https://api.github.com/users/soletan/events{/privacy}","received_events_url":"https://api.github.com/users/soletan/received_events","type":"User","site_admin":false},"created_at":"2016-03-06T10:46:46Z","updated_at":"2016-03-06T10:46:46Z","body":"Ok, forget about it ... I was pretty flashed by sailsjs and how it matches the way I want to start developing web applications. But this bot-stuff here is a definite nogo for me to ever report issues, help in extending or sth. like that."}}