{"action":"created","issue":{"url":"https://api.github.com/repos/nikku/karma-browserify/issues/50","labels_url":"https://api.github.com/repos/nikku/karma-browserify/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/nikku/karma-browserify/issues/50/comments","events_url":"https://api.github.com/repos/nikku/karma-browserify/issues/50/events","html_url":"https://github.com/nikku/karma-browserify/issues/50","id":48771742,"number":50,"title":"Uncaught Error: Cannot find module","user":{"login":"kristijanhusak","id":1782860,"avatar_url":"https://avatars.githubusercontent.com/u/1782860?v=3","gravatar_id":"","url":"https://api.github.com/users/kristijanhusak","html_url":"https://github.com/kristijanhusak","followers_url":"https://api.github.com/users/kristijanhusak/followers","following_url":"https://api.github.com/users/kristijanhusak/following{/other_user}","gists_url":"https://api.github.com/users/kristijanhusak/gists{/gist_id}","starred_url":"https://api.github.com/users/kristijanhusak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kristijanhusak/subscriptions","organizations_url":"https://api.github.com/users/kristijanhusak/orgs","repos_url":"https://api.github.com/users/kristijanhusak/repos","events_url":"https://api.github.com/users/kristijanhusak/events{/privacy}","received_events_url":"https://api.github.com/users/kristijanhusak/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2014-11-14T10:55:36Z","updated_at":"2015-01-28T00:01:43Z","closed_at":"2014-11-14T18:32:10Z","body":"Hello,\r\n\r\nI am trying to set up karma + browserify for my boilerplate project, but i get strange error.\r\n\r\nI managed to set up browserify with gulp without any problem, it works and compiles everything like it should, but with this i get the problem. \r\n\r\nIt's a big report, but I want to show how confusing it is.\r\n```\r\n☁  /var/www/boilerplate/assets/js/tests [gulp-browserify] ⚡  karma start karmaconf.js \r\nDEBUG [plugin]: Loading karma-* from /var/www/boilerplate/assets/js/tests/node_modules\r\nDEBUG [plugin]: Loading plugin /var/www/boilerplate/assets/js/tests/node_modules/karma-browserify.\r\nDEBUG [plugin]: Loading plugin /var/www/boilerplate/assets/js/tests/node_modules/karma-chrome-launcher.\r\nDEBUG [plugin]: Loading plugin /var/www/boilerplate/assets/js/tests/node_modules/karma-growl-notifications-reporter.\r\nDEBUG [plugin]: Loading plugin /var/www/boilerplate/assets/js/tests/node_modules/karma-jasmine.\r\nDEBUG [plugin]: Loading plugin /var/www/boilerplate/assets/js/tests/node_modules/karma-jasmine-html-reporter.\r\nDEBUG [plugin]: Loading plugin /var/www/boilerplate/assets/js/tests/node_modules/karma-sinon.\r\nDEBUG [plugin]: Loading plugin /var/www/boilerplate/assets/js/tests/node_modules/karma-spec-reporter.\r\nDEBUG [framework.browserify]: created browserify bundle: /tmp/e23abc7c0b33cd65128e2f9d77ad57525fd1fdbe.browserify\r\nINFO [framework.browserify]: registering rebuild (autoWatch=true)\r\nDEBUG [framework.browserify]: add bundle to config.files at position 3\r\nINFO [karma]: Karma v0.12.24 server started at http://localhost:9876/\r\nINFO [launcher]: Starting browser Chrome\r\nDEBUG [temp-dir]: Creating temp dir at /tmp/karma-91928800\r\nDEBUG [launcher]: google-chrome --user-data-dir=/tmp/karma-91928800 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:9876/?id=91928800\r\nWARN [watcher]: Pattern \"/var/www/boilerplate/assets/js/collections/**/*.js\" does not match any file.\r\nWARN [watcher]: Pattern \"/var/www/boilerplate/assets/js/libs/**/*.js\" does not match any file.\r\nWARN [watcher]: Pattern \"/var/www/boilerplate/assets/js/tests/collections/**/*.js\" does not match any file.\r\nWARN [watcher]: Pattern \"/var/www/boilerplate/assets/js/tests/models/**/*.js\" does not match any file.\r\nDEBUG [framework.browserify]: building bundle\r\nDEBUG [framework.browserify]: adding ../views/example-view.js to bundle\r\nDEBUG [framework.browserify]: adding ../views/global.js to bundle\r\nDEBUG [framework.browserify]: adding ../pages/home.js to bundle\r\nDEBUG [framework.browserify]: adding ../models/example-model.js to bundle\r\nDEBUG [framework.browserify]: adding libs/jasmine-jquery.js to bundle\r\nDEBUG [framework.browserify]: adding pages/home.js to bundle\r\nDEBUG [framework.browserify]: adding views/exampleViewSpec.js to bundle\r\nDEBUG [framework.browserify]: bundling\r\nDEBUG [web-server]: serving: /var/www/boilerplate/assets/js/tests/node_modules/karma/static/client.html\r\nINFO [framework.browserify]: 420134 bytes written (1.07 seconds)\r\nINFO [framework.browserify]: bundle built\r\nDEBUG [watcher]: Resolved files:\r\n\t/var/www/boilerplate/assets/js/tests/node_modules/karma-jasmine/lib/jasmine.js\r\n\t/var/www/boilerplate/assets/js/tests/node_modules/karma-jasmine/lib/boot.js\r\n\t/var/www/boilerplate/assets/js/tests/node_modules/karma-jasmine/lib/adapter.js\r\n\t/tmp/e23abc7c0b33cd65128e2f9d77ad57525fd1fdbe.browserify\r\n\t/var/www/boilerplate/assets/js/views/example-view.js\r\n\t/var/www/boilerplate/assets/js/views/global.js\r\n\t/var/www/boilerplate/assets/js/pages/home.js\r\n\t/var/www/boilerplate/assets/js/models/example-model.js\r\n\t/var/www/boilerplate/assets/js/tests/libs/jasmine-jquery.js\r\n\t/var/www/boilerplate/assets/js/tests/pages/home.js\r\n\t/var/www/boilerplate/assets/js/tests/views/exampleViewSpec.js\r\nDEBUG [watcher]: Watching \"/tmp/e23abc7c0b33cd65128e2f9d77ad57525fd1fdbe.browserify\"\r\nDEBUG [watcher]: Watching \"/var/www/boilerplate/assets/js/views\"\r\nDEBUG [watcher]: Watching \"/var/www/boilerplate/assets/js/pages\"\r\nDEBUG [watcher]: Watching \"/var/www/boilerplate/assets/js/collections\"\r\nDEBUG [watcher]: Watching \"/var/www/boilerplate/assets/js/models\"\r\nDEBUG [watcher]: Watching \"/var/www/boilerplate/assets/js/libs\"\r\nDEBUG [watcher]: Watching \"/var/www/boilerplate/assets/js/tests/collections\"\r\nDEBUG [watcher]: Watching \"/var/www/boilerplate/assets/js/tests/libs\"\r\nDEBUG [watcher]: Watching \"/var/www/boilerplate/assets/js/tests/models\"\r\nDEBUG [watcher]: Watching \"/var/www/boilerplate/assets/js/tests/pages\"\r\nDEBUG [watcher]: Watching \"/var/www/boilerplate/assets/js/tests/views\"\r\nDEBUG [web-server]: serving: /var/www/boilerplate/assets/js/tests/node_modules/karma/static/karma.js\r\nDEBUG [watcher]: Add file \"/var/www/boilerplate/assets/js/views/example-view.js\" ignored. Already in the list.\r\nDEBUG [watcher]: Add file \"/var/www/boilerplate/assets/js/views/global.js\" ignored. Already in the list.\r\nDEBUG [watcher]: Add file \"/var/www/boilerplate/assets/js/pages/home.js\" ignored. Already in the list.\r\nDEBUG [watcher]: Add file \"/var/www/boilerplate/assets/js/models/example-model.js\" ignored. Already in the list.\r\nDEBUG [watcher]: Add file \"/var/www/boilerplate/assets/js/tests/libs/jasmine-jquery.js\" ignored. Already in the list.\r\nDEBUG [watcher]: Add file \"/var/www/boilerplate/assets/js/tests/pages/home.js\" ignored. Already in the list.\r\nDEBUG [watcher]: Add file \"/var/www/boilerplate/assets/js/tests/views/exampleViewSpec.js\" ignored. Already in the list.\r\nDEBUG [web-server]: upgrade /socket.io/1/websocket/unLhpoJxvOon0BHK53D8\r\nDEBUG [karma]: A browser has connected on socket unLhpoJxvOon0BHK53D8\r\nINFO [Chrome 38.0.2125 (Linux)]: Connected on socket unLhpoJxvOon0BHK53D8 with id 91928800\r\nDEBUG [launcher]: Chrome (id 91928800) captured in 2.198 secs\r\nDEBUG [karma]: All browsers are ready, executing\r\nDEBUG [web-server]: serving: /var/www/boilerplate/assets/js/tests/node_modules/karma/static/context.html\r\nDEBUG [web-server]: serving (cached): /var/www/boilerplate/assets/js/tests/node_modules/karma-jasmine/lib/jasmine.js\r\nDEBUG [web-server]: serving (cached): /var/www/boilerplate/assets/js/tests/node_modules/karma-jasmine/lib/boot.js\r\nDEBUG [web-server]: serving (cached): /var/www/boilerplate/assets/js/tests/node_modules/karma-jasmine/lib/adapter.js\r\nDEBUG [web-server]: serving (cached): /tmp/e23abc7c0b33cd65128e2f9d77ad57525fd1fdbe.browserify\r\nDEBUG [web-server]: serving (cached): /var/www/boilerplate/assets/js/views/example-view.js\r\nDEBUG [web-server]: serving (cached): /var/www/boilerplate/assets/js/views/global.js\r\nDEBUG [web-server]: serving (cached): /var/www/boilerplate/assets/js/pages/home.js\r\nDEBUG [web-server]: serving (cached): /var/www/boilerplate/assets/js/models/example-model.js\r\nDEBUG [web-server]: serving (cached): /var/www/boilerplate/assets/js/tests/libs/jasmine-jquery.js\r\nDEBUG [web-server]: serving (cached): /var/www/boilerplate/assets/js/tests/pages/home.js\r\nDEBUG [web-server]: serving (cached): /var/www/boilerplate/assets/js/tests/views/exampleViewSpec.js\r\nChrome 38.0.2125 (Linux) ERROR\r\n  Uncaught Error: Cannot find module '/var/www/boilerplate/assets/js/views/global.js'\r\n  at /tmp/e23abc7c0b33cd65128e2f9d77ad57525fd1fdbe.browserify:1\r\n\r\nChrome 38.0.2125 (Linux) ERROR\r\n  Uncaught Error: Cannot find module '/var/www/boilerplate/assets/js/views/global.js'\r\n  at /tmp/e23abc7c0b33cd65128e2f9d77ad57525fd1fdbe.browserify:1\r\n\r\nChrome 38.0.2125 (Linux) ERROR\r\n  Uncaught Error: Cannot find module '/var/www/boilerplate/assets/js/views/global.js'\r\n  at /tmp/e23abc7c0b33cd65128e2f9d77ad57525fd1fdbe.browserify:1\r\n\r\n```\r\n\r\nAbove the errors, it shows that it found those files and that it load them, and after that it throws an error. I don't know why is this happening ? \r\n\r\nThis is content of `/var/www/boilerplate/assets/js/views/global.js`:\r\n\r\n```js\r\nmodule.exports = function() {\r\n    \"use strict\";\r\n    window.jQuery = require('jquery');\r\n    window.$ = window.jQuery;\r\n    window.Backbone = require('backbone');\r\n    window._ = require('underscore');\r\n    window.Backbone.$ = window.$;\r\n};\r\n```\r\n\r\nIf you need any other info or file content, let me know and i'll provide it. Thanks."},"comment":{"url":"https://api.github.com/repos/nikku/karma-browserify/issues/comments/71755442","html_url":"https://github.com/nikku/karma-browserify/issues/50#issuecomment-71755442","issue_url":"https://api.github.com/repos/nikku/karma-browserify/issues/50","id":71755442,"user":{"login":"bendrucker","id":808808,"avatar_url":"https://avatars.githubusercontent.com/u/808808?v=3","gravatar_id":"","url":"https://api.github.com/users/bendrucker","html_url":"https://github.com/bendrucker","followers_url":"https://api.github.com/users/bendrucker/followers","following_url":"https://api.github.com/users/bendrucker/following{/other_user}","gists_url":"https://api.github.com/users/bendrucker/gists{/gist_id}","starred_url":"https://api.github.com/users/bendrucker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bendrucker/subscriptions","organizations_url":"https://api.github.com/users/bendrucker/orgs","repos_url":"https://api.github.com/users/bendrucker/repos","events_url":"https://api.github.com/users/bendrucker/events{/privacy}","received_events_url":"https://api.github.com/users/bendrucker/received_events","type":"User","site_admin":false},"created_at":"2015-01-28T00:01:43Z","updated_at":"2015-01-28T00:01:43Z","body":"That's there because I'm using browserify-shim to transform `require('angular')` into `window.angular` as part of the bundling process. At some point I'm going to revisit my process there and see if I can eliminate all window globals. I write a lot of modules and just assuming Angular is a global is pretty easy. At some point I'll try to clean up the process a bit.\r\n\r\nSpecifically, I really need to write up what I mentioned in https://github.com/thlorenz/browserify-shim/issues/107 in order for CommonJS + Angular to not suck."}}