{"action":"created","issue":{"url":"https://api.github.com/repos/serverless/serverless/issues/365","labels_url":"https://api.github.com/repos/serverless/serverless/issues/365/labels{/name}","comments_url":"https://api.github.com/repos/serverless/serverless/issues/365/comments","events_url":"https://api.github.com/repos/serverless/serverless/issues/365/events","html_url":"https://github.com/serverless/serverless/issues/365","id":121787251,"number":365,"title":"Error thrown by `module create` on Windows","user":{"login":"mewdriller","id":492553,"avatar_url":"https://avatars.githubusercontent.com/u/492553?v=3","gravatar_id":"","url":"https://api.github.com/users/mewdriller","html_url":"https://github.com/mewdriller","followers_url":"https://api.github.com/users/mewdriller/followers","following_url":"https://api.github.com/users/mewdriller/following{/other_user}","gists_url":"https://api.github.com/users/mewdriller/gists{/gist_id}","starred_url":"https://api.github.com/users/mewdriller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mewdriller/subscriptions","organizations_url":"https://api.github.com/users/mewdriller/orgs","repos_url":"https://api.github.com/users/mewdriller/repos","events_url":"https://api.github.com/users/mewdriller/events{/privacy}","received_events_url":"https://api.github.com/users/mewdriller/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-11T20:38:26Z","updated_at":"2015-12-11T21:29:38Z","closed_at":null,"body":"Below is the full stack trace: \r\n\r\n```\r\nλ serverless module create -m greetings -f hello\r\nC:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\node_modules\\bluebird\\js\\main\\promise.js:677\r\n            throw e;\r\n            ^\r\n\r\nError: ENOENT: no such file or directory, mkdir 'C:\\Users\\dmiller\\workspace\\b2io\\markr-next\\back\\modules\\greetings\\hello\\s-function.json'\r\n    at Error (native)\r\n    at Object.fs.mkdirSync (fs.js:842:18)\r\n    at FunctionCreate._createFunctionSkeleton (C:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\lib\\actions\\FunctionCreate.js:232:12)\r\nFrom previous event:\r\n    at FunctionCreate.functionCreate (C:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\lib\\actions\\FunctionCreate.js:108:10)\r\nFrom previous event:\r\n    at C:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\lib\\Serverless.js:207:25\r\n    at Array.reduce (native)\r\n    at Object.actions.(anonymous function) [as functionCreate] (C:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\lib\\Serverless.js:206:25)\r\n    at ModuleCreate.<anonymous> (C:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\lib\\actions\\ModuleCreate.js:115:34)\r\nFrom previous event:\r\n    at ModuleCreate.moduleCreate (C:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\lib\\actions\\ModuleCreate.js:109:10)\r\n    at processImmediate [as _immediateCallback] (timers.js:383:17)\r\nFrom previous event:\r\n    at C:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\lib\\Serverless.js:207:25\r\n    at Array.reduce (native)\r\n    at Serverless.actions.(anonymous function) (C:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\lib\\Serverless.js:206:25)\r\n    at Serverless.command (C:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\lib\\Serverless.js:180:44)\r\n    at Object.<anonymous> (C:\\Users\\dmiller\\AppData\\Roaming\\npm\\node_modules\\serverless\\bin\\serverless:13:36)\r\n    at Module._compile (module.js:425:26)\r\n    at Object.Module._extensions..js (module.js:432:10)\r\n    at Module.load (module.js:356:32)\r\n    at Function.Module._load (module.js:313:12)\r\n    at Function.Module.runMain (module.js:457:10)\r\n    at startup (node.js:138:18)\r\n    at node.js:974:3\r\n```\r\n\r\nFor reference, I'm running `serverless` v0.0.12 in Node v5.1.0 on Windows 10 x64."},"comment":{"url":"https://api.github.com/repos/serverless/serverless/issues/comments/164052017","html_url":"https://github.com/serverless/serverless/issues/365#issuecomment-164052017","issue_url":"https://api.github.com/repos/serverless/serverless/issues/365","id":164052017,"user":{"login":"mewdriller","id":492553,"avatar_url":"https://avatars.githubusercontent.com/u/492553?v=3","gravatar_id":"","url":"https://api.github.com/users/mewdriller","html_url":"https://github.com/mewdriller","followers_url":"https://api.github.com/users/mewdriller/followers","following_url":"https://api.github.com/users/mewdriller/following{/other_user}","gists_url":"https://api.github.com/users/mewdriller/gists{/gist_id}","starred_url":"https://api.github.com/users/mewdriller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mewdriller/subscriptions","organizations_url":"https://api.github.com/users/mewdriller/orgs","repos_url":"https://api.github.com/users/mewdriller/repos","events_url":"https://api.github.com/users/mewdriller/events{/privacy}","received_events_url":"https://api.github.com/users/mewdriller/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T21:29:38Z","updated_at":"2015-12-11T21:29:38Z","body":"@ac360: From fiddling with the files locally, it looks like the issue is this [String.replace call](https://github.com/serverless/serverless/blob/master/lib/actions/FunctionCreate.js#L232) that's assuming `/` as the path-separator (it's `\\` on Windows). I changed that function to look like this:\r\n\r\n```js\r\n  _createFunctionSkeleton() {\r\n\r\n    let _this                = this,\r\n        writeDeferred        = [],\r\n        eventJson            = {},\r\n        handlerJs            = fs.readFileSync(path.join(this._templatesDir, 'nodejs', 'handler.js'));\r\n\r\n    // Set function on event\r\n    let functionJson                   = _this._generateFunctionJson();\r\n    let functionObject                 = functionJson.functions[Object.keys(functionJson.functions)[0]];\r\n    functionObject.name                = this.evt.function;\r\n    this.evt.function                  = functionObject;\r\n    eventJson[_this.evt.function.name] = {};\r\n\r\n    const functionPath = _this.evt.function.pathFunction.replace('s-function.json', '');\r\n\r\n    // Write function structure\r\n    writeDeferred.push(\r\n        fs.mkdirSync(functionPath),\r\n        SUtils.writeFile(path.join(functionPath, 'handler.js'), handlerJs),\r\n        SUtils.writeFile(path.join(functionPath, 'event.json'), JSON.stringify(eventJson, null, 2)),\r\n        SUtils.writeFile(_this.evt.function.pathFunction, JSON.stringify(functionJson, null, 2))\r\n    );\r\n\r\n    return BbPromise.all(writeDeferred);\r\n  };\r\n```"}}