{"action":"created","issue":{"url":"https://api.github.com/repos/jsreport/jsreport/issues/409","repository_url":"https://api.github.com/repos/jsreport/jsreport","labels_url":"https://api.github.com/repos/jsreport/jsreport/issues/409/labels{/name}","comments_url":"https://api.github.com/repos/jsreport/jsreport/issues/409/comments","events_url":"https://api.github.com/repos/jsreport/jsreport/issues/409/events","html_url":"https://github.com/jsreport/jsreport/issues/409","id":324699761,"number":409,"title":"Error when loading extension phantom-pdf aspnet core","user":{"login":"irowbin","id":13050078,"avatar_url":"https://avatars0.githubusercontent.com/u/13050078?v=4","gravatar_id":"","url":"https://api.github.com/users/irowbin","html_url":"https://github.com/irowbin","followers_url":"https://api.github.com/users/irowbin/followers","following_url":"https://api.github.com/users/irowbin/following{/other_user}","gists_url":"https://api.github.com/users/irowbin/gists{/gist_id}","starred_url":"https://api.github.com/users/irowbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irowbin/subscriptions","organizations_url":"https://api.github.com/users/irowbin/orgs","repos_url":"https://api.github.com/users/irowbin/repos","events_url":"https://api.github.com/users/irowbin/events{/privacy}","received_events_url":"https://api.github.com/users/irowbin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-20T10:42:32Z","updated_at":"2018-05-21T14:26:47Z","closed_at":null,"author_association":"NONE","body":"I am getting this error:\r\n`Error when loading extension phantom-pdf\r\nError: ENOENT: no such file or directory, scandir 'C:\\Users\\Robin\\AppData\\Local\\Temp\\node_modules'\r\n    at crawlAvailiblePhantomVersions (D:\\Projects\\App\\node_modules\\jsreport-phantom-pdf\\lib\\phantom.js:69:12)\r\n    at Phantom.init (D:\\Projects\\App\\node_modules\\jsreport-phantom-pdf\\lib\\phantom.js:81:10)\r\n    at Object.module.exports (D:\\Projects\\App\\node_modules\\jsreport-phantom-pdf\\lib\\phantom.js:244:36)\r\n    at Object._useOne (D:\\Projects\\App\\node_modules\\jsreport-core\\lib\\extensions\\extensionsManager.js:154:75)\r\n    at Object._useMany (D:\\Projects\\App\\node_modules\\jsreport-core\\lib\\extensions\\extensionsManager.js:73:20)\r\n    at <anonymous>\r\nError: Error when loading extension phantom-pdf\r\nError: ENOENT: no such file or directory, scandir 'C:\\Users\\Robin\\AppData\\Local\\Temp\\node_modules'\r\n    at crawlAvailiblePhantomVersions (D:\\Projects\\App\\node_modules\\jsreport-phantom-pdf\\lib\\phantom.js:69:12)\r\n    at Phantom.init (D:\\Projects\\App\\node_modules\\jsreport-phantom-pdf\\lib\\phantom.js:81:10)\r\n    at Object.module.exports (D:\\Projects\\App\\node_modules\\jsreport-phantom-pdf\\lib\\phantom.js:244:36)\r\n    at Object._useOne (D:\\Projects\\App\\node_modules\\jsreport-core\\lib\\extensions\\extensionsManager.js:154:75)\r\n    at Object._useMany (D:\\Projects\\App\\node_modules\\jsreport-core\\lib\\extensions\\extensionsManager.js:73:20)\r\n    at <anonymous>\r\n    at Object._useOne (D:\\Projects\\App\\node_modules\\jsreport-core\\lib\\extensions\\extensionsManager.js:163:15)\r\n    at <anonymous>`\r\n\r\nproject structure \r\n![capture](https://user-images.githubusercontent.com/13050078/40278075-119937d8-5c4a-11e8-8fcf-38ec8947bc30.JPG)\r\n\r\n\r\npackage.json\r\n```json\r\n{\r\n  \"dependencies\": {\r\n    \"jsreport-core\": \"^2.0.1\",\r\n    \"jsreport-jsrender\": \"^2.0.0\",\r\n    \"jsreport-phantom-pdf\": \"^2.0.1\",\r\n    \"phantom-pdf\": \"^0.4.1\",\r\n    \"phantomjs-prebuilt\": \"^2.1.16\"\r\n  }\r\n}\r\n```\r\n\r\nhtmlToPdf.js file\r\n\r\n```javascript\r\nmodule.exports = function (callback, html) {\r\n    var jsreport = require('jsreport-core')();\r\n\r\n    jsreport.init().then(function () {\r\n        return jsreport.render({\r\n            template: {\r\n                content: html,\r\n                engine: 'jsrender',\r\n                recipe: 'phantom-pdf'\r\n            }\r\n        }).then(function (resp) {\r\n            callback(/* error */ null, resp.content);\r\n        });\r\n    }).catch(function (e) {\r\n        callback(/* error */ e, null);\r\n    })\r\n};\r\n```\r\n\r\nstartup.cs\r\n```c#\r\n services.AddNodeServices( o =>\r\n {\r\n    o.InvocationTimeoutMilliseconds = 300000;\r\n    o.LaunchWithDebugging           = true;\r\n\r\n } );\r\n```\r\n\r\ncontroller\r\n\r\n```c#\r\nprivate readonly INodeServices   _nodeServices;\r\n\r\npublic HomeController(INodeServices  nodeServices  ){\r\n         nodeServices  = _nodeServices;\r\n}\r\n\r\npublic async Task<IActionResult> Export(){\r\n      var htmlContent = \"<div class='alert alert-danger'> hello from jsreport </div>\"\r\n      var result = await _nodeServices.InvokeAsync<byte[]>(\"./htmlToPdf\", htmlContent);\r\n}\r\n```\r\n\r\nI am unable to track down the error whether it is coming from this ` var jsreport = require('jsreport-core')();` or  from `INodeServices`🤔\r\n"},"comment":{"url":"https://api.github.com/repos/jsreport/jsreport/issues/comments/390670189","html_url":"https://github.com/jsreport/jsreport/issues/409#issuecomment-390670189","issue_url":"https://api.github.com/repos/jsreport/jsreport/issues/409","id":390670189,"user":{"login":"pofider","id":2041960,"avatar_url":"https://avatars2.githubusercontent.com/u/2041960?v=4","gravatar_id":"","url":"https://api.github.com/users/pofider","html_url":"https://github.com/pofider","followers_url":"https://api.github.com/users/pofider/followers","following_url":"https://api.github.com/users/pofider/following{/other_user}","gists_url":"https://api.github.com/users/pofider/gists{/gist_id}","starred_url":"https://api.github.com/users/pofider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pofider/subscriptions","organizations_url":"https://api.github.com/users/pofider/orgs","repos_url":"https://api.github.com/users/pofider/repos","events_url":"https://api.github.com/users/pofider/events{/privacy}","received_events_url":"https://api.github.com/users/pofider/received_events","type":"User","site_admin":false},"created_at":"2018-05-21T14:26:47Z","updated_at":"2018-05-21T14:26:47Z","author_association":"CONTRIBUTOR","body":"It looks that for some reason your node/jsreport starts from the temp directory. Try to set up the app directory explicitelly.\r\n\r\n```js\r\njsreport.init({\r\n appDirectory: 'dir where is your package.json'\r\n})\r\n```\r\n"}}
{"actor":{"display_login":"pofider"}}