Skip to content

ng build help shows incorrect flag options #1934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jasonswett opened this issue Sep 1, 2016 · 2 comments
Closed

ng build help shows incorrect flag options #1934

jasonswett opened this issue Sep 1, 2016 · 2 comments

Comments

@jasonswett
Copy link

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.

@filipesilva
Copy link
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.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants