{"action":"created","issue":{"url":"https://api.github.com/repos/manifoldjs/ManifoldJS/issues/213","repository_url":"https://api.github.com/repos/manifoldjs/ManifoldJS","labels_url":"https://api.github.com/repos/manifoldjs/ManifoldJS/issues/213/labels{/name}","comments_url":"https://api.github.com/repos/manifoldjs/ManifoldJS/issues/213/comments","events_url":"https://api.github.com/repos/manifoldjs/ManifoldJS/issues/213/events","html_url":"https://github.com/manifoldjs/ManifoldJS/issues/213","id":157310379,"number":213,"title":"ManifoldJS can't run from node_modules/ folder","user":{"login":"zackhall","id":1725349,"avatar_url":"https://avatars.githubusercontent.com/u/1725349?v=3","gravatar_id":"","url":"https://api.github.com/users/zackhall","html_url":"https://github.com/zackhall","followers_url":"https://api.github.com/users/zackhall/followers","following_url":"https://api.github.com/users/zackhall/following{/other_user}","gists_url":"https://api.github.com/users/zackhall/gists{/gist_id}","starred_url":"https://api.github.com/users/zackhall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zackhall/subscriptions","organizations_url":"https://api.github.com/users/zackhall/orgs","repos_url":"https://api.github.com/users/zackhall/repos","events_url":"https://api.github.com/users/zackhall/events{/privacy}","received_events_url":"https://api.github.com/users/zackhall/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-05-28T00:14:51Z","updated_at":"2016-06-02T13:56:08Z","closed_at":null,"body":"I'm trying to create a script that creates a project with manifold and then runs it immediately. \r\n\r\nThe node script does something like this:\r\n\r\n```js\r\n/*\r\n *  script.js\r\n */\r\n...\r\ncp.execSync(`manifoldjs http://localhost:3000/ -d ${localDir} -p windows10 -l info`, {stdio: [0,1,2]});\r\ncp.execSync(`manifoldjs run windows10`, { stdio: [0,1,2], cwd: cwd });\r\n```\r\n\r\nWhen running straight from a command prompt like `node script.js` it runs okay. If I try to put it in an npm script like:\r\n\r\n```json\r\n{\r\n  ...\r\n  \"scripts\": {\r\n    \"start:local\": \"node script.js\"\r\n  },\r\n  ...\r\n}\r\n```\r\n\r\nI get the following error:\r\n\r\n```\r\n[warn ] general     : Manifest validation SUGGESTION - It is recommended to specify a set of rules that represent the navigation scope of the application(member: mjs_extended_scope).\r\n[warn ] general     : Manifest validation WARNING    - Unknown property (not in schema)(member: /lang).\r\n[warn ] windows10   : Manifest validation WARNING    - A small square logo of any of the following sizes is required for Windows: 24x24, 30x30, 42x42, 54x54(member: icons).\r\n[warn ] windows10   : Manifest validation WARNING    - A small tile logo of any of the following sizes is required for Windows Phone: 71x71, 99x99, 170x170(member: icons).\r\n[debug] manifoldjs  : Creating the 'Windows 10 Platform' app...\r\n[info ] windows10   : Generating the Windows 10 Platform app...\r\n[debug] windows10   : Creating the Windows 10 Platform app folder...\r\n[debug] windows10   : Copying the Windows 10 Platform manifest to the app folder...\r\n[debug] windows10   : Downloading the windows10 icons...\r\n[debug] manifoldjs  : Downloading icon file from 'http://localhost:3000/img/icons/Icon@44w.png' to 'E:\\github\\hwa-starter\\tmp\\local\\StarterPack\\windows10\\manifest\\images\\smalllogo.scale-100.png'...\r\n[debug] manifoldjs  : Downloading icon file from 'http://localhost:3000/img/icons/Icon@50w.png' to 'E:\\github\\hwa-starter\\tmp\\local\\StarterPack\\windows10\\manifest\\images\\storelogo.scale-100.png'...\r\n[debug] manifoldjs  : Downloading icon file from 'http://localhost:3000/img/icons/Icon@150w.png' to 'E:\\github\\hwa-starter\\tmp\\local\\StarterPack\\windows10\\manifest\\images\\logo.scale-100.png'...\r\n[debug] manifoldjs  : Downloading icon file from 'http://localhost:3000/img/icons/Splash@620w.png' to 'E:\\github\\hwa-starter\\tmp\\local\\StarterPack\\windows10\\manifest\\images\\splashscreen.scale-100.png'...\r\n[info ] windows10   : Copying offline file \"msapp-error.html\" to target: E:\\github\\hwa-starter\\tmp\\local\\StarterPack\\windows10\\manifest\\msapp-error.html...\r\n[info ] windows10   : Copying files to the Windows 10 Platform source project...\r\n[info ] windows10   : Copying documentation from 'E:\\github\\hwa-starter\\node_modules\\manifoldjs-windows10\\lib\\docs' to 'E:\\github\\hwa-starter\\tmp\\local\\StarterPack\\windows10'...\r\n\r\n\r\n[error] manifoldjs  : Failed to create the Windows 10 Platform app.\r\n                          at E:\\github\\hwa-starter\\node_modules\\manifoldjs-lib\\lib\\projectBuilder.js:95:27\r\n                          at _rejected (E:\\github\\hwa-starter\\node_modules\\q\\q.js:844:24)\r\n                          at E:\\github\\hwa-starter\\node_modules\\q\\q.js:870:30\r\n                          at Promise.when (E:\\github\\hwa-starter\\node_modules\\q\\q.js:1122:31)\r\n                          at Promise.promise.promiseDispatch (E:\\github\\hwa-starter\\node_modules\\q\\q.js:788:41)\r\n                          at E:\\github\\hwa-starter\\node_modules\\q\\q.js:604:44\r\n                          at runSingle (E:\\github\\hwa-starter\\node_modules\\q\\q.js:137:13)\r\n                          at flush (E:\\github\\hwa-starter\\node_modules\\q\\q.js:125:13)\r\n                          at _combinedTickCallback (internal/process/next_tick.js:67:7)\r\n                          at process._tickCallback (internal/process/next_tick.js:98:9)\r\n\r\n-->>                 Error retrieving information for module: 'manifoldjs-windows10'.\r\n                          at Object.getPackageInformation (E:\\github\\hwa-starter\\node_modules\\manifoldjs-lib\\lib\\packageTools.js:77:11)\r\n                          at PlatformBase.self.writeGenerationInfo (E:\\github\\hwa-starter\\node_modules\\manifoldjs-lib\\lib\\platformBase.js:248:39)\r\n                          at E:\\github\\hwa-starter\\node_modules\\manifoldjs-windows10\\lib\\platform.js:108:21\r\n                          at _fulfilled (E:\\github\\hwa-starter\\node_modules\\q\\q.js:834:54)\r\n                          at self.promiseDispatch.done (E:\\github\\hwa-starter\\node_modules\\q\\q.js:863:30)\r\n                          at Promise.promise.promiseDispatch (E:\\github\\hwa-starter\\node_modules\\q\\q.js:796:13)\r\n                          at E:\\github\\hwa-starter\\node_modules\\q\\q.js:604:44\r\n                          at runSingle (E:\\github\\hwa-starter\\node_modules\\q\\q.js:137:13)\r\n                          at flush (E:\\github\\hwa-starter\\node_modules\\q\\q.js:125:13)\r\n                          at _combinedTickCallback (internal/process/next_tick.js:67:7)\r\n[error] manifoldjs  : One or more platforms could not be generated successfully.\r\n                          at E:\\github\\hwa-starter\\node_modules\\manifoldjs-lib\\lib\\projectBuilder.js:28:23\r\n                          at _fulfilled (E:\\github\\hwa-starter\\node_modules\\q\\q.js:834:54)\r\n                          at self.promiseDispatch.done (E:\\github\\hwa-starter\\node_modules\\q\\q.js:863:30)\r\n                          at Promise.promise.promiseDispatch (E:\\github\\hwa-starter\\node_modules\\q\\q.js:796:13)\r\n                          at E:\\github\\hwa-starter\\node_modules\\q\\q.js:604:44\r\n                          at runSingle (E:\\github\\hwa-starter\\node_modules\\q\\q.js:137:13)\r\n                          at flush (E:\\github\\hwa-starter\\node_modules\\q\\q.js:125:13)\r\n                          at _combinedTickCallback (internal/process/next_tick.js:67:7)\r\n                          at process._tickCallback (internal/process/next_tick.js:98:9)\r\n[error] manifoldjs  : The specified directory does not appear to contain a valid manifoldjs project.\r\n                      For more information, run manifoldjs with the diagnostics level set to debug (e.g. manifoldjs [...] -l debug)\r\n```\r\n\r\nIs there any guidance on using this from an npm script?"},"comment":{"url":"https://api.github.com/repos/manifoldjs/ManifoldJS/issues/comments/223299045","html_url":"https://github.com/manifoldjs/ManifoldJS/issues/213#issuecomment-223299045","issue_url":"https://api.github.com/repos/manifoldjs/ManifoldJS/issues/213","id":223299045,"user":{"login":"f2bo","id":1148767,"avatar_url":"https://avatars.githubusercontent.com/u/1148767?v=3","gravatar_id":"","url":"https://api.github.com/users/f2bo","html_url":"https://github.com/f2bo","followers_url":"https://api.github.com/users/f2bo/followers","following_url":"https://api.github.com/users/f2bo/following{/other_user}","gists_url":"https://api.github.com/users/f2bo/gists{/gist_id}","starred_url":"https://api.github.com/users/f2bo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f2bo/subscriptions","organizations_url":"https://api.github.com/users/f2bo/orgs","repos_url":"https://api.github.com/users/f2bo/repos","events_url":"https://api.github.com/users/f2bo/events{/privacy}","received_events_url":"https://api.github.com/users/f2bo/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T13:56:08Z","updated_at":"2016-06-02T13:56:08Z","body":"Hi @zackhall \r\n\r\nThe approach suggested by @boyofgreen seems more appropriate for you scenario. Also, starting with the latest release, we moved most of the core code into a separate library so I would recommend taking a dependency on **manifoldjs-lib** rather than **manifoldjs**. \r\n\r\nNevertheless, I think the problem you currently have could be fixed if you replace the implementation of **getPackageInformation** in **manifoldjs-lib/lib/packageTools.js** with the following code. It would be very helpful to know if this solves the problem so that we might consider including this change in the next release.\r\n\r\n``` node\r\nfunction getPackageInformation (packageName) {\r\n  \r\n  try {\r\n    var packagePath = path.dirname(require.main.filename);\r\n    var modulesPath = path.join(packagePath, node_modules);\r\n    \r\n    try { fs.statSync(modulesPath).isDirectory() }\r\n    catch (er) { \r\n      modulesPath = path.resolve(packagePath, '..');  \r\n    }\r\n    \r\n    if (packageName) {\r\n      packagePath = path.join(modulesPath, packageName);      \r\n    }\r\n    \r\n    packagePath = path.join(packagePath, packageJson);\r\n    \r\n    return require(packagePath);  \r\n  }\r\n  catch (err) {\r\n    throw new Error('Error retrieving information for module: \\'' + (packageName || 'main') + '\\'.');    \r\n  }\r\n}\r\n```"}}
{"actor":{"display_login":"f2bo"}}