Angular-cli: Custom output path is not working

Created on 8 Feb 2017  ·  9Comments  ·  Source: angular/angular-cli

I want to create separate distributions for each locale. And when I'm trying following commands, however I am not able to create custom output folder. Please help.

ng build --outDir=customDist
ng build --output-path=customDist
ng build --outDir customDist
ng build --output-path customDist

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Answer : Windows 10

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

Answer : node version is 6.2.1

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Answer : I've created this app with Angular CLI. The Angular CLI version is 1.0.0-beta.30

easy (hours) help wanted investigation 3 (nice to have) regression

All 9 comments

It works for me.

➜  cool-app git:(master) ng new cool-app
➜  cool-app git:(master) cd cool-app
➜  cool-app git:(master) ls -l
total 24
-rw-r--r--   1 catull developer  1084 Feb  9 13:52 README.md
-rw-r--r--   1 catull developer  1335 Feb  9 13:52 angular-cli.json
drwxr-xr-x   5 catull developer   170 Feb  9 13:52 e2e/
-rw-r--r--   1 catull developer  1130 Feb  9 13:52 karma.conf.js
drwxr-xr-x 750 catull developer 25500 Feb  9 13:53 node_modules/
-rw-r--r--   1 catull developer  1230 Feb  9 13:52 package.json
-rw-r--r--   1 catull developer   757 Feb  9 13:52 protractor.conf.js
drwxr-xr-x  12 catull developer   408 Feb  9 13:52 src/
-rw-r--r--   1 catull developer  2691 Feb  9 13:52 tslint.json



md5-154c0ca1b44429673fcb198b245f8ccb



```log
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
Hash: fdc44788121dcfeb3983
Time: 9090ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.map (polyfills) 147 kB {4} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.map (main) 3.91 kB {3} [initial] [rendered]
chunk    {2} styles.bundle.js, styles.bundle.map (styles) 10 kB {4} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.38 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]



md5-1472ee12c7ef565e3908f9645e8ca9a4



```log
total 24
-rw-r--r--   1 catull developer  1084 Feb  9 13:52 README.md
-rw-r--r--   1 catull developer  1335 Feb  9 13:52 angular-cli.json
drwxr-xr-x  14 catull developer   476 Feb  9 13:55 customDist/
drwxr-xr-x   5 catull developer   170 Feb  9 13:52 e2e/
-rw-r--r--   1 catull developer  1130 Feb  9 13:52 karma.conf.js
drwxr-xr-x 750 catull developer 25500 Feb  9 13:53 node_modules/
-rw-r--r--   1 catull developer  1230 Feb  9 13:52 package.json
-rw-r--r--   1 catull developer   757 Feb  9 13:52 protractor.conf.js
drwxr-xr-x  12 catull developer   408 Feb  9 13:52 src/
-rw-r--r--   1 catull developer  2691 Feb  9 13:52 tslint.json



md5-9e7f0e919e95b326431394396cad0de3



```log
v7.5.0



md5-b13a5c9bc2ef313230ec5bb3273ac09a



```log
4.1.2



md5-2dac2af7059581c505b639b985da84f1



```log
                             _                           _  _
  __ _  _ __    __ _  _   _ | |  __ _  _ __         ___ | |(_)
 / _` || '_ \  / _` || | | || | / _` || '__|_____  / __|| || |
| (_| || | | || (_| || |_| || || (_| || |  |_____|| (__ | || |
 \__,_||_| |_| \__, | \__,_||_| \__,_||_|          \___||_||_|
               |___/
@angular/cli: 1.0.0-beta.30
node: 7.5.0
os: darwin x64
@angular/common: 2.4.7
@angular/compiler: 2.4.7
@angular/core: 2.4.7
@angular/forms: 2.4.7
@angular/http: 2.4.7
@angular/platform-browser: 2.4.7
@angular/platform-browser-dynamic: 2.4.7
@angular/router: 3.4.7
@angular/cli: 1.0.0-beta.30
@angular/compiler-cli: 2.4.7

This works for me as well, and we test for it.

The correct usage is ng build --output-path=customDist as @catull showed.

Are there any other details that you can give that would help show why it doesn't work for you?

@filipesilva, its works:

ng build --output-path=customDist

But this not works:

ng build --output-path=../customDist

And this not works:

ng build --output-path=/var/www/project/customDist

My environment:

node: 7.10.0
os: linux x64
@angular/animations: 4.1.0
@angular/common: 4.0.2
@angular/compiler: 4.0.2
@angular/core: 4.0.2
@angular/forms: 4.0.2
@angular/http: 4.0.2
@angular/platform-browser: 4.0.2
@angular/platform-browser-dynamic: 4.0.2
@angular/router: 4.0.2
@angular/cli: 1.0.1
@angular/compiler-cli: 4.0.2

It somehow still generated files, but with strange glitches.

If I run the command ng build --output-path=/var/www/project/customDist in first terminal, but check the result in second terminal, in second terminal files are not visible. And if I run ng --version in second terminal, I have this error:

$ ng -v
path.js:1142
cwd = process.cwd();
^

Error: ENOENT: no such file or directory, uv_cwd
at Object.resolve (path.js:1142:25)
at Function.Module._resolveLookupPaths (module.js:391:17)
at Function.Module._resolveFilename (module.js:461:31)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/@angular/cli/bin/ng:7:19)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)

Then, if I run ng --version in first terminal, both terminals start to work correctly and I can see generated files.

I'll reopen to have a look.

@filipesilva, I apologize, it seems that this glitches no longer occurred. Maybe described above problems arose because of a problem with RAM overflow (4 GB) and with read/write to the swap...

@KostyaTretyak glad to hear it's not an issue for you anymore 👍

Works for me in Windows 10
ng build --output-path=customDist

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daBishMan picture daBishMan  ·  3Comments

MateenKadwaikar picture MateenKadwaikar  ·  3Comments

brtnshrdr picture brtnshrdr  ·  3Comments

JanStureNielsen picture JanStureNielsen  ·  3Comments

delasteve picture delasteve  ·  3Comments