{ "id": "165774", "key": "TIMOB-24373", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2018-08-13T07:37:32.000+0000", "created": "2017-02-04T03:57:50.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "cb-tooling" ], "versions": [], "issuelinks": [ { "id": "54201", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "165606", "key": "ALOY-1540", "fields": { "summary": "npm node_modules are erroring when compiling", "status": { "description": "This issue was once resolved, but the resolution was deemed incorrect. From here issues are either marked assigned or resolved.", "name": "Reopened", "id": "4", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": null, "updated": "2018-08-13T07:37:33.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "*Reproduce Steps*\r\n1. Create a ti classic app\r\n2. Create a package.json file under Resources folder:\r\n{code}\r\n{\r\n \"name\": \"myapp\",\r\n \"description\": \"myapp\",\r\n \"private\": true,\r\n \"dependencies\": {\r\n },\r\n \"devDependencies\": {\r\n \"mocha\": \"2.5.3\",\r\n \"should\": \"7.1.1\",\r\n \"ti-mocha\": \"0.2.0\"\r\n }\r\n}\r\n{code}\r\n3. Run {{npm install}} under Resources folder\r\n4. Build the project\r\n\r\n*Expected Result*\r\nThe app builds without error\r\n\r\n*Actual Result*\r\n{code}\r\n[ERROR] Failed to parse /Users/feonsua/work/apps/test/Resources/node_modules/mocha/node_modules/glob/test/00-setup.js\r\n[ERROR] SyntaxError: 'return' outside of function [line 82, column 0]\r\n[ERROR] \r\n[ERROR] }\r\n[ERROR] \r\n{code}", "attachment": [], "flagged": false, "summary": "npm node_modules are erroring out during build", "creator": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "subtasks": [], "reporter": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "environment": null, "closedSprints": [ { "id": 1058, "state": "closed", "name": "2018 Sprint 16 SDK", "startDate": "2018-07-29T22:26:06.486Z", "endDate": "2018-08-12T22:26:00.000Z", "completeDate": "2018-08-13T17:38:16.757Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "407319", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Well, we don't have a lot of options. We either A) gut the entire {{catch}} clause and completely ignore any parse errors, or B) replace the {{this.logger.error}} with {{this.logger.warn}} and remove the {{process.exit(1)}}.\r\n\r\n{code}\r\ntry {\r\n\t// parse the AST\r\n\tvar r = jsanalyze.analyzeJsFile(from, { minify: this.minifyJS });\r\n} catch (ex) {\r\n\tex.message.split('\\n').forEach(this.logger.error);\r\n\tthis.logger.log();\r\n\tprocess.exit(1);\r\n}\r\n{code}\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/blob/master/iphone/cli/commands/_build.js#L5642-L5649\r\n\r\nWe AST parse all .js files using Uglify to find all Titanium APIs that are used so we can enable only the modules that are needed. The second we trying parsing a .js file that Uglify doesn't like or understand, the build fails. This is actually a much bigger problem than some bad .js syntax. The version of Uglify that we use is pretty old and doesn't support the latest ECMAScript standards. This means valid syntax will cause builds to fail. The next major Titanium build architecture will use Babylon, which is fantastic and allows plugins that will adapt to new standard changes. Unfortunately, we can't just rip out Uglify and drop in Babylon. It's going to be a significant amount of work.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2017-02-17T19:31:52.000+0000", "updated": "2017-02-17T19:31:52.000+0000" }, { "id": "417137", "author": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "As a workaround for anyone dealing with this issue, you can use nativeloop https://github.com/nativeloop/nativeloop. Basically, nativeloop looks for every call to uglifyjs.parse and make sure to run babeljs before those calls. This ensures that the code is downgraded to an es5 format before uglifyjs tries to parse it.", "updateAuthor": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2017-04-10T18:45:14.000+0000", "updated": "2017-04-10T18:45:14.000+0000" }, { "id": "440682", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Duplicate of ALOY-1540, fixed in Alloy 1.9.11+", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-13T07:37:33.000+0000", "updated": "2018-08-13T07:37:33.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }