Skip to content

Minimist reference throwing error on NGC build #8436

@eestein

Description

@eestein

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

eestein@SteinMac sdk-front (master) $ ng --version

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.5.0
Node: 7.7.3
OS: darwin x64
Angular: 5.0.1
... common, compiler, compiler-cli, core, forms, http
... platform-browser, platform-browser-dynamic, router

@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.2
typescript: 2.4.2
webpack: 3.8.1

Repro steps.

Create a lib project and run ngc

gulp ngc task:

gulp.task('ngc', function () {
    return ngc({
        project: `${tmpFolder}/tsconfig.es5.json`
    })
        .then((exitCode) => {
            if (exitCode === 1) {
                throw new Error('Compiler error');
            }
        });
});

The log given by the failure.

[10:18:41] TypeError: args.indexOf is not a function
    at module.exports (/Users/eestein/Documents/dev/dacasa/sdk-front/node_modules/minimist/index.js:44:14)
    at readNgcCommandLineAndConfiguration (/Users/eestein/Documents/dev/dacasa/sdk-front/node_modules/@angular/compiler-cli/src/main.js:66:41)
    at main (/Users/eestein/Documents/dev/dacasa/sdk-front/node_modules/@angular/compiler-cli/src/main.js:21:24)
    at Gulp.<anonymous> (/Users/eestein/Documents/dev/dacasa/sdk-front/gulpfile.js:47:12)
    at module.exports (/Users/eestein/Documents/dev/dacasa/sdk-front/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/eestein/Documents/dev/dacasa/sdk-front/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/eestein/Documents/dev/dacasa/sdk-front/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/Users/eestein/Documents/dev/dacasa/sdk-front/node_modules/orchestrator/index.js:134:8)
    at runNextSet (/Users/eestein/Documents/dev/dacasa/sdk-front/node_modules/run-sequence/index.js:86:16)
    at Gulp.onTaskEnd (/Users/eestein/Documents/dev/dacasa/sdk-front/node_modules/run-sequence/index.js:75:5)
ERROR: args.indexOf is not a function

Desired functionality.

Run build with no error

Mention any other details that might be useful.

minimist code:

    var notFlags = [];

    if (args.indexOf('--') !== -1) {                   // line throwing error
        notFlags = args.slice(args.indexOf('--')+1);
        args = args.slice(0, args.indexOf('--'));
    }

compiler-cli code:

function readNgcCommandLineAndConfiguration(args) {
    var options = {};
    var parsedArgs = require('minimist')(args);                  // line throwing error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions