{ "id": "171924", "key": "ALOY-1624", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2018-07-12T17:17:04.000+0000", "priority": null, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-08-20T21:07:59.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [], "description": "When I try to use moment, like I always did:\r\n\r\n{code:js}\r\nvar moment = require('/alloy/moment');\r\nvar date = moment(myDate).format('DD/MM/YYYY - HH:mm');\r\n{code}\r\n\r\nI get the error from the title:\r\n\r\nmoment is not a function. (In 'moment(myDate)', 'moment' is an instance of Object)\r\n\r\nwhere moment is actually an object:\r\n\r\n{code}\r\n {\r\n id = \"alloy/moment.js\";\r\n uri = \"app://alloy/moment.js\";\r\n }\r\n{code}", "attachment": [], "flagged": false, "summary": "Alloy: moment is not a function. (In 'moment(myDate)', 'moment' is an instance of Object)", "creator": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "environment": "TiSDK 7.2.0", "comment": { "comments": [ { "id": "439232", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi [~a.marcone], just checked myself with 7.2.0.GA with the code you provided and it seems to be working. Are you overriding moment in your app anywhere? \r\n\r\n", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-07-16T07:59:28.000+0000", "updated": "2018-07-16T07:59:35.000+0000" }, { "id": "439299", "author": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi, moment is not overridden anywhere.\r\n\r\nI just noticed that I get the same error with other alloy libraries:\r\n\r\n{code}var animation = require('alloy/animation');{code}\r\n\r\n{code}\r\n[INFO] : animation : {\r\n[INFO] : id = \"alloy/animation.js\";\r\n[INFO] : uri = \"app://alloy/animation.js\";\r\n[INFO] : }\r\n{code}\r\n\r\nthis doesn't happen on an empty project indeed. Not sure where to look for, any idea?", "updateAuthor": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-07-18T13:51:41.000+0000", "updated": "2018-07-18T13:51:41.000+0000" }, { "id": "439320", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "[~topener], [~a.marcone], I can't reproduce either on both iOS and Android. SDK 7.2.0.GA and CLI 7.0.4.\r\n\r\n[~a.marcone] \r\n1. Does this only happen to {{requiring}} alloy builtins?\r\n2. Does {{require}} not work for both iOS and Android for you?\r\n3. Which SDK works/worked for you?\r\n\r\nIt will help greatly if you could upload an app that we can use to reproduce the issue.\r\n\r\n\r\n", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2018-07-18T21:31:55.000+0000", "updated": "2018-07-18T21:31:55.000+0000" }, { "id": "439332", "author": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "body": "We tested it on 3 different workstations, it works on one (where the project was initially developed - linux) but it doesn't work on other two ( linux - mac). This happens on either Android or iOS.\r\nThe projects are checked out from our repository in the same way, there are no differences. It's not a matter of SDK because it works with the same SDK on one workstation but it doesn't on another.\r\nThis happens only with the alloy builtins, we have other commonjs libs in the lib/ folder and they work as expected. We can't reproduce the same problem with another mock project because, as noted above, it only happens with this project.\r\n\r\nAt this point we're not asking for a complete solution, just if you give us enough pointers to understand where to look at during the alloy requiring. \r\n\r\nThank you very much", "updateAuthor": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-07-19T08:27:03.000+0000", "updated": "2018-07-19T08:27:03.000+0000" }, { "id": "439333", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Can you send a copy of your project (confidential of course) to our core team via hknoechel@axway.com? We will then try to reproduce and check if we can fix up the project.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-07-19T08:29:45.000+0000", "updated": "2018-07-19T08:29:45.000+0000" }, { "id": "441433", "author": { "name": "spyromus", "key": "spyromus", "displayName": "Aleksey Gureiev", "active": true, "timeZone": "Europe/Helsinki" }, "body": "This also happens to our project sporadically. I discovered that when it happens, `build/iphone/assets/alloy/moment_js` and `.../dialogs_js` are completely empty. However `widget_js` and `underscore_js` are alright. Hope it helps.\r\n\r\nI seem can't find how to make it work again. It just restores itself after a couple of times removing build, app, and platform folders. Sometimes I even reinstall all node_modules.", "updateAuthor": { "name": "spyromus", "key": "spyromus", "displayName": "Aleksey Gureiev", "active": true, "timeZone": "Europe/Helsinki" }, "created": "2018-09-10T10:00:24.000+0000", "updated": "2018-09-10T10:00:24.000+0000" }, { "id": "448863", "author": { "name": "Nirmalkumar_Patel", "key": "nirmalkumar_patel", "displayName": "Nirmal", "active": true, "timeZone": "America/Chicago" }, "body": "This usually happens after an attempt to build has failed with a compiler error.\r\nSubsequent builds will throw this runtime error not able to find built-in library - in my case moment.\r\n\r\nResetting the build cache using `appc clean` makes this error go away.", "updateAuthor": { "name": "Nirmalkumar_Patel", "key": "nirmalkumar_patel", "displayName": "Nirmal", "active": true, "timeZone": "America/Chicago" }, "created": "2019-06-05T17:27:04.000+0000", "updated": "2019-06-05T17:27:04.000+0000" }, { "id": "450649", "author": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Leaving a comment in case this ever gets solved. ", "updateAuthor": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-08-20T21:07:59.000+0000", "updated": "2019-08-20T21:07:59.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }