Angular-cli: ng build adds brackets to path

Created on 10 Jul 2019  路  7Comments  路  Source: angular/angular-cli

馃悶 Bug report

Command (mark with an x)


- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Not that I know off

Description

A clear and concise description of the problem...

When running ng build via Jenkins on Windows, paths defined in angular.jsons assets does not get included.

The root cause of the issue seems to be with brackets ( & ) in the path. Using Process Monitor, i found the paths called where not found.

They look like this:
C:\Program Files [(]x86[)]\Jenkins\workspace\Uti...

馃敩 Minimal Reproduction

Create folder: C:\test (x86)\

Open CMD (admin elevated)
Run commands:

cd "C:\text (x86)\"
ng new helloworld
cd helloworld
ng build --aot

馃敟 Exception or Error

None in the CLI, neither in normal or verbose mode

馃實 Your Environment


Angular CLI: 8.0.6
Node: 10.15.3
OS: win32 x64
Angular: 8.1.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.6
@angular-devkit/build-angular     0.800.6
@angular-devkit/build-optimizer   0.800.6
@angular-devkit/build-webpack     0.800.6
@angular-devkit/core              8.0.6
@angular-devkit/schematics        8.0.6
@angular/cdk                      8.0.2
@angular/cli                      8.0.6
@angular/fire                     5.2.1
@angular/material                 8.0.2
@ngtools/webpack                  8.0.6
@schematics/angular               8.0.6
@schematics/update                0.800.6
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?

OS: Window Server 2016

devkibuild-angular low broken triage #1 bufix

Most helpful comment

Agreed -- hit this problem today whilst migrating builds from one server to another. The worst part, it silently fails so you think the build works instead of just exploding so you know something is wrong!

All 7 comments

H @cf-jolai I just looked at this and I am not able to replicate your problem.

Here's what I did:

$ mkdir "Foo (x8)"
$ cd "Foo (x8)"
$ ng new test
$ cd test
$ ng build

$ ls dist\test\ | grep favicon.ico
favicon.ico // assets have been copied succesfully

Note: I tried this on a windows machine.

  • Is there any error or the assets are just not copied?
  • What is the assets pattern that you have defined?

The assets are defined like this:

"assets": [
    "src/web.config",
    "src/assets"
],

and there's no errors visible in the console, not even with verbose.
Only found the errors by checking the node process events.

For replication:
OS: Windows Server 2016
Path: C:\test (x86)\

Open CMD (admin elevated)
Run commmands:

cd "C:\text (x86)\"
ng new helloworld
cd helloworld
ng build --aot

I'll update the OP with this info too.

Thanks for your prompt reply. I managed to replicate the issue using git bash.

As stated in this comment, the bug only seems to occur, if the folder directly under C:\ contains a bracket.
So a project under C:\b(r)acket will be affected by the bug, while a project under C:\test\b(r)acket won't be affected.
Unfortunately this is the case for Program Files (x86) on windows systems.

Also seeing the behavior, causing an issue with Jenkins builds.

Agreed -- hit this problem today whilst migrating builds from one server to another. The worst part, it silently fails so you think the build works instead of just exploding so you know something is wrong!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

donaldallen picture donaldallen  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

rwillmer picture rwillmer  路  3Comments

NCC1701M picture NCC1701M  路  3Comments