{"action":"created","issue":{"url":"https://api.github.com/repos/Codeception/CodeceptJS/issues/10","labels_url":"https://api.github.com/repos/Codeception/CodeceptJS/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/Codeception/CodeceptJS/issues/10/comments","events_url":"https://api.github.com/repos/Codeception/CodeceptJS/issues/10/events","html_url":"https://github.com/Codeception/CodeceptJS/issues/10","id":120569600,"number":10,"title":"Helper loading issues","user":{"login":"pim","id":85532,"avatar_url":"https://avatars.githubusercontent.com/u/85532?v=3","gravatar_id":"","url":"https://api.github.com/users/pim","html_url":"https://github.com/pim","followers_url":"https://api.github.com/users/pim/followers","following_url":"https://api.github.com/users/pim/following{/other_user}","gists_url":"https://api.github.com/users/pim/gists{/gist_id}","starred_url":"https://api.github.com/users/pim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pim/subscriptions","organizations_url":"https://api.github.com/users/pim/orgs","repos_url":"https://api.github.com/users/pim/repos","events_url":"https://api.github.com/users/pim/events{/privacy}","received_events_url":"https://api.github.com/users/pim/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Codeception/CodeceptJS/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-05T16:27:07Z","updated_at":"2015-12-05T20:02:45Z","closed_at":null,"body":"Hey,\r\n\r\nI had some troubles with [creating my own helper](http://codecept.io/helpers/) I’d like to share.\r\n\r\nI created one with `codeceptjs gh` command and then run the whole suite with `codeceptjs run --steps`.\r\n\r\nThis is the error I got:\r\n\r\n```\r\nError: Could not load helper UrlHelper from module './helper/UrlHelper'\r\nCannot find module './helper/UrlHelper'\r\n```\r\n\r\nThe fix for this was changing [this line in container.js](https://github.com/Codeception/CodeceptJS/blob/master/lib/container.js#L9) to:\r\n\r\n```\r\nlet HelperClass = require(helperModule = config[helperName].require || './helper/'+helperName);\r\n```\r\n\r\nAfter this, the error was:\r\n\r\n```\r\nError: Could not load helper UrlHelper from module './url_helper.js'\r\nCannot find module './url_helper.js'\r\n```\r\n\r\nI had a feeling that it tried to look for my module in `/usr/local/lib/node_modules/codeceptjs` (where `container.js` is), so I replaced `./url_helper.js` in my `package.json` with an absolute path to the file. The file was loaded correctly after doing this.\r\n\r\nThe next error was that it couldn’t find `codeceptjs/helper` module that I require in my `url_helper.js` file, so I replaced it with an ugly absolute path to it `/usr/local/lib/node_modules/codeceptjs/lib/helper`. The helper was loaded correctly after this.\r\n\r\nWhile it all works now for me, relying on absolute paths isn’t really a solution so I think I must be doing something wrong. Any help will be appreciated! I’m on node `v4.2.3` if that helps.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/Codeception/CodeceptJS/issues/comments/162242242","html_url":"https://github.com/Codeception/CodeceptJS/issues/10#issuecomment-162242242","issue_url":"https://api.github.com/repos/Codeception/CodeceptJS/issues/10","id":162242242,"user":{"login":"pim","id":85532,"avatar_url":"https://avatars.githubusercontent.com/u/85532?v=3","gravatar_id":"","url":"https://api.github.com/users/pim","html_url":"https://github.com/pim","followers_url":"https://api.github.com/users/pim/followers","following_url":"https://api.github.com/users/pim/following{/other_user}","gists_url":"https://api.github.com/users/pim/gists{/gist_id}","starred_url":"https://api.github.com/users/pim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pim/subscriptions","organizations_url":"https://api.github.com/users/pim/orgs","repos_url":"https://api.github.com/users/pim/repos","events_url":"https://api.github.com/users/pim/events{/privacy}","received_events_url":"https://api.github.com/users/pim/received_events","type":"User","site_admin":false},"created_at":"2015-12-05T20:02:45Z","updated_at":"2015-12-05T20:02:45Z","body":"Thanks a lot!"}}