{"action":"created","issue":{"url":"https://api.github.com/repos/jxcore/jxcore/issues/542","labels_url":"https://api.github.com/repos/jxcore/jxcore/issues/542/labels{/name}","comments_url":"https://api.github.com/repos/jxcore/jxcore/issues/542/comments","events_url":"https://api.github.com/repos/jxcore/jxcore/issues/542/events","html_url":"https://github.com/jxcore/jxcore/issues/542","id":106237172,"number":542,"title":"using npm module in packaged up jxcore binary","user":{"login":"pirog","id":713424,"avatar_url":"https://avatars.githubusercontent.com/u/713424?v=3","gravatar_id":"","url":"https://api.github.com/users/pirog","html_url":"https://github.com/pirog","followers_url":"https://api.github.com/users/pirog/followers","following_url":"https://api.github.com/users/pirog/following{/other_user}","gists_url":"https://api.github.com/users/pirog/gists{/gist_id}","starred_url":"https://api.github.com/users/pirog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pirog/subscriptions","organizations_url":"https://api.github.com/users/pirog/orgs","repos_url":"https://api.github.com/users/pirog/repos","events_url":"https://api.github.com/users/pirog/events{/privacy}","received_events_url":"https://api.github.com/users/pirog/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-13T20:08:20Z","updated_at":"2015-09-13T20:56:38Z","closed_at":null,"body":"So we are working on a project over at https://github.com/kalabox/kalabox\r\n\r\nGetting close to rolling out a useable release and have been considering easier ways to distribute. Thinking about the option of compiling into a binary lead us here. \r\n\r\nUsing `jx` seems to work pretty well but there are 2 big issues that are roadblocking us. Both are documented at https://github.com/kalabox/kalabox/issues/464#issuecomment-139907519.\r\n\r\nThe first is easily solvable but the second seems much more elusive and strange hence the ticket here for some guidance. \r\n\r\nAt the end of the day we need to programmatically copy the skeleton of a node project over into another directory and then `npm install`. The `npm install` part is the tricky part. We have npm packaged up inside the generated binary but it seems to crash with the following when it tries to do the programmatic `npm install`. \r\n\r\n```\r\nENOENT, no such file or directory '/usr/local/bin/node_modules/npm/node_modules/npm-registry-client/lib'\r\nError: ENOENT, no such file or directory '/usr/local/bin/node_modules/npm/node_modules/npm-registry-client/lib'\r\n    at Object.fs.readdirSync (evalmachine.<anonymous>:717:20)\r\n    at CachingRegistryClient.RegClient (/usr/local/bin/node_modules/npm/node_modules/npm-registry-client/index.js.jx:49:6)\r\n    at new CachingRegistryClient (/usr/local/bin/node_modules/npm/lib/cache/caching-client.js.jx:19:18)\r\n    at /usr/local/bin/node_modules/npm/lib/npm.js.jx:362:22\r\n    at /usr/local/bin/node_modules/npm/lib/config/core.js.jx:81:7\r\n    at Array.forEach (native)\r\n    at /usr/local/bin/node_modules/npm/lib/config/core.js.jx:80:13\r\n    at f (/usr/local/bin/node_modules/npm/node_modules/once/once.js.jx:16:25)\r\n    at finalize (/usr/local/bin/node_modules/npm/lib/config/core.js.jx:199:5)\r\n    at afterExtras (/usr/local/bin/node_modules/npm/lib/config/core.js.jx:190:5)\r\n    at /usr/local/bin/node_modules/npm/node_modules/mkdirp/index.js.jx:47:26\r\n    at Object.oncomplete (fs.js:82:15)\r\n```\r\n\r\nThe files it is looking for are in the .jxp file\r\n\r\n```\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/access.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/adduser.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/attempt.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/authify.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/deprecate.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/dist-tags/add.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/dist-tags/fetch.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/dist-tags/rm.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/dist-tags/set.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/dist-tags/update.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/fetch.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/get.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/initialize.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/logout.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/ping.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/publish.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/request.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/star.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/stars.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/tag.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/team.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/unpublish.js\",\r\n\t\t\"node_modules/npm/node_modules/npm-registry-client/lib/whoami.js\",\r\n```\r\n\r\nIs there anything obviously wrong about what we are trying to do here? "},"comment":{"url":"https://api.github.com/repos/jxcore/jxcore/issues/comments/139917513","html_url":"https://github.com/jxcore/jxcore/issues/542#issuecomment-139917513","issue_url":"https://api.github.com/repos/jxcore/jxcore/issues/542","id":139917513,"user":{"login":"ktrzeciaknubisa","id":5946844,"avatar_url":"https://avatars.githubusercontent.com/u/5946844?v=3","gravatar_id":"","url":"https://api.github.com/users/ktrzeciaknubisa","html_url":"https://github.com/ktrzeciaknubisa","followers_url":"https://api.github.com/users/ktrzeciaknubisa/followers","following_url":"https://api.github.com/users/ktrzeciaknubisa/following{/other_user}","gists_url":"https://api.github.com/users/ktrzeciaknubisa/gists{/gist_id}","starred_url":"https://api.github.com/users/ktrzeciaknubisa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktrzeciaknubisa/subscriptions","organizations_url":"https://api.github.com/users/ktrzeciaknubisa/orgs","repos_url":"https://api.github.com/users/ktrzeciaknubisa/repos","events_url":"https://api.github.com/users/ktrzeciaknubisa/events{/privacy}","received_events_url":"https://api.github.com/users/ktrzeciaknubisa/received_events","type":"User","site_admin":false},"created_at":"2015-09-13T20:56:38Z","updated_at":"2015-09-13T20:56:38Z","body":"Generally we were advising to run binary packages from their own location. See for example: https://github.com/jxcore/jxcore/issues/466. \r\n\r\nCould you please make a test and copy kbox to your app dir and run `./kbox` from there to see if this makes any difference?"}}