Skip to content

ng build help shows incorrect flag options #1934

Closed

Description

@jasonswett

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Max OS X, although I imagine that's not relevant.
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
    1.0.0-beta.11-webpack.8
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.

If you run ng build --help, you see as one option:

 --environment (String) (Default: development)
    aliases: -e <value>, -dev (--environment=development), -prod (--environment=production)

If you then run this
ng build --environment=production

you get "Path must be a string. Received undefined".

If you do ng build --environment=prod, it works. I'm assuming this is because there's an src/environments/environment.prod.ts file but not src/environments/environment.production.ts.

Seems like the help output should be corrected and you should get a friendlier error if you provide a bogus environment value.

  1. The log given by the failure. Normally this include a stack trace and some
    more information.
Path must be a string. Received undefined
TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.resolve (path.js:1148:7)
    at Object.getWebpackCommonConfig (/Users/jasonswett/projects/scratch/foo/node_modules/angular-cli/addon/ng2/models/webpack-build-common.ts:128:80)
    at new NgCliWebpackConfig (/Users/jasonswett/projects/scratch/foo/node_modules/angular-cli/addon/ng2/models/webpack-config.ts:13:30)
    at Class.run (/Users/jasonswett/projects/scratch/foo/node_modules/angular-cli/addon/ng2/tasks/build-webpack.ts:16:22)
    at Class.run (/Users/jasonswett/projects/scratch/foo/node_modules/angular-cli/addon/ng2/commands/build.ts:49:26)
    at Class.<anonymous> (/Users/jasonswett/projects/scratch/foo/node_modules/angular-cli/lib/models/command.js:152:17)
    at lib$rsvp$$internal$$tryCatch (/Users/jasonswett/projects/scratch/foo/node_modules/rsvp/dist/rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/jasonswett/projects/scratch/foo/node_modules/rsvp/dist/rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (/Users/jasonswett/projects/scratch/foo/node_modules/rsvp/dist/rsvp.js:1019:11)
    at lib$rsvp$asap$$flush (/Users/jasonswett/projects/scratch/foo/node_modules/rsvp/dist/rsvp.js:1198:9)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
  1. Mention any other details that might be useful.

Thanks! We'll be in touch soon.

Activity

  1. filipesilva commented on Sep 21, 2016

    @filipesilva
    Contributor

    Fixed by #2041 and latest (beta.15) release. Also see https://github.com/angular/angular-cli#webpack-update regarding changes in environments and upgrade path.

  2. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  3. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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