{"action":"closed","issue":{"url":"https://api.github.com/repos/aurelia/documentation/issues/280","repository_url":"https://api.github.com/repos/aurelia/documentation","labels_url":"https://api.github.com/repos/aurelia/documentation/issues/280/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/documentation/issues/280/comments","events_url":"https://api.github.com/repos/aurelia/documentation/issues/280/events","html_url":"https://github.com/aurelia/documentation/issues/280","id":176525803,"number":280,"title":"aurelia-cli: Dependency trace fails when the require() target is a directory","user":{"login":"kkagamida","id":5799068,"avatar_url":"https://avatars.githubusercontent.com/u/5799068?v=3","gravatar_id":"","url":"https://api.github.com/users/kkagamida","html_url":"https://github.com/kkagamida","followers_url":"https://api.github.com/users/kkagamida/followers","following_url":"https://api.github.com/users/kkagamida/following{/other_user}","gists_url":"https://api.github.com/users/kkagamida/gists{/gist_id}","starred_url":"https://api.github.com/users/kkagamida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kkagamida/subscriptions","organizations_url":"https://api.github.com/users/kkagamida/orgs","repos_url":"https://api.github.com/users/kkagamida/repos","events_url":"https://api.github.com/users/kkagamida/events{/privacy}","received_events_url":"https://api.github.com/users/kkagamida/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aurelia/documentation/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-13T01:29:20Z","updated_at":"2016-09-30T19:03:32Z","closed_at":"2016-09-30T19:03:32Z","body":"<!--\r\nBUGS: Please use this template.\r\n\r\nSUPPORT REQUESTS/QUESTIONS: If you have a support request or question please\r\nsubmit them to StackOverflow using the tags aurelia and aurelia-framework\r\nhttp://stackoverflow.com/questions/tagged/aurelia\r\nor the Aurelia Gitter https://gitter.im/aurelia/discuss\r\n\r\nDurandal Inc. offers paid support agreements. Further information regarding paid support\r\nmay be obtained by emailing support@durandal.io\r\n\r\nFuture support requests submitted here will be closed.\r\n\r\nThe HTML comments below are for your reference, and are not displayed\r\nwhen your issue is submitted, feel free to leave them.\r\n\r\nChoose one of the two headings, delete the other.\r\n-->\r\n**I'm submitting a bug report**\r\n\r\n* **Library Version:**\r\n0.19.0\r\n\r\n\r\n**Please tell us about your environment:**\r\n* **Operating System:**\r\nWindows Server 2012 R2\r\n\r\n* **Node Version:**\r\n6.5.0\r\n<!--\r\nMinimum supported Node version is latest Node 4.x LTS\r\nrun `node -v`\r\n-->\r\n\r\n* **NPM Version:**\r\n3.10.3\r\n<!--\r\nMinimum supported NPM version is 3.x\r\nrun `npm -v`\r\n-->\r\n\r\n* **JSPM OR Webpack AND Version**\r\nJSPM 0.16.45\r\n<!--\r\nIf using JSPM\r\nrun `jspm -v`\r\nIf using Webpack\r\nrun `webpack --help | grep webpack`\r\n-->\r\n\r\n* **Browser:**\r\nChrome 53\r\n\r\n* **Language:**\r\nESNext\r\n\r\n\r\n**Current behavior:**\r\nWhen executing **au run**, an error occurs during the dependency trace when the target of a call to require() is a directory.\r\n\r\nThis behavior became apparent when trying to use the mongodb package. The index.js file contains the line:\r\n\r\n    connect.GridFSBucket = require('./lib/gridfs-stream');\r\n\r\nwhere gridfs-stream is a directory.\r\n\r\nTo reproduce the error:\r\n* Create a new project using **au new**.\r\n* Create a \"test\" directory under \"src\".\r\n* Add the line \"var test = require('./test');\" to app.js.\r\n* Start the app using **au run**.\r\n\r\nThe attached zip file can be used if desired.  Extract into the src directory.\r\n[src.zip](https://github.com/aurelia/documentation/files/468664/src.zip)\r\n\r\n\r\nExample output:\r\n\r\n    Tracing app...\r\n    { uid: 9,\r\n      name: 'writeBundles',\r\n      branch: false,\r\n      error:\r\n       { Error: ENOENT: no such file or directory, open 'C:\\dev\\aurelia-cli-bug\\src\\\r\n    test.js'\r\n           at Error (native)\r\n           at Object.fs.openSync (fs.js:640:18)\r\n           at Object.fs.readFileSync (fs.js:508:33)\r\n           at Object.exports.readFileSync (C:\\dev\\aurelia-cli-bug\\node_modules\\aurel\r\n    ia-cli\\lib\\file-system.js:38:13)\r\n           at fileRead (C:\\dev\\aurelia-cli-bug\\node_modules\\aurelia-cli\\lib\\build\\bu\r\n    ndled-source.js:83:31)\r\n           at Object.context.fileRead (C:\\dev\\aurelia-cli-bug\\node_modules\\aurelia-c\r\n    li\\lib\\build\\amodro-trace\\lib\\loader\\Loader.js:176:18)\r\n           at Object.context.load (C:\\dev\\aurelia-cli-bug\\node_modules\\aurelia-cli\\l\r\n    ib\\build\\amodro-trace\\lib\\loader\\Loader.js:357:30)\r\n           at Object.load (eval at <anonymous> (C:\\dev\\aurelia-cli-bug\\node_modules\\\r\n    aurelia-cli\\lib\\build\\amodro-trace\\lib\\loader\\Loader.js:14:9), <anonymous>:832:29)\r\n           at Object.fetch (eval at <anonymous> (C:\\dev\\aurelia-cli-bug\\node_modules\r\n    \\aurelia-cli\\lib\\build\\amodro-trace\\lib\\loader\\Loader.js:14:9), <anonymous>:822:66)\r\n           at Object.check (eval at <anonymous> (C:\\dev\\aurelia-cli-bug\\node_modules\r\n    \\aurelia-cli\\lib\\build\\amodro-trace\\lib\\loader\\Loader.js:14:9), <anonymous>:854:30)\r\n         errno: -4058,\r\n         code: 'ENOENT',\r\n         syscall: 'open',\r\n         path: 'C:\\\\dev\\\\aurelia-cli-bug\\\\src\\\\test.js',\r\n         moduleTree: [ 'app' ],\r\n         fileName: 'C:/dev/aurelia-cli-bug/src/app.js' },\r\n      duration: [ 0, 41572159 ],\r\n      time: 1473727816150 }\r\n\r\n\r\n**Expected/desired behavior:**\r\n<!--\r\nIf the current behavior is a bug, please provide the steps to reproduce and, if possible, a minimal demo of the\r\nproblem along with a runnable gist, if possible.\r\nTo create a runnable gist, go to https://gist.run/?id=7542e061bc940cde506b&sha=6821c521a6c7bae6f59a36fb8628ecd1032b2d10\r\nThen click \"Fork to Public Gist\".\r\nCreate your gist, then finally click \"Update Gist.\" Include a link to the gist.run below.\r\n-->\r\n\r\n\r\n* **What is the expected behavior?**\r\nAccording to the node.js documentation, having a directory as the target of require() is allowed, so the dependency trace should not assume that the target is a .js file.\r\n\r\n* **What is the motivation / use case for changing the behavior?**\r\nTo be able to install modules such as mongodb without having to modify the module code.\r\n\r\n"}}
{"actor":{"display_login":"kkagamida"}}