Angular-cli: ng build --watch broken

Created on 4 Oct 2016  路  5Comments  路  Source: angular/angular-cli

OS?

Mac OSX (El Capitan)

Versions.

angular-cli: 1.0.0-beta.16
node: 6.7.0 (I also tried it on 5.12.0 and 4.6.0)
os: darwin x64

Repro steps.

  1. npm install -g angular-cli@latest
  2. ng new build-watch
  3. cd build-watch
  4. ng build -w

    The log given by the failure.

Path must be a string. Received null
TypeError: Path must be a string. Received null
    at assertPath (path.js:7:11)
    at Object.resolve (path.js:1148:7)
    at Class.run (/Users/jonathansamples/projects/build-watch/node_modules/angular-cli/tasks/build-webpack-watch.js:14:26)
    at Class.run (/Users/jonathansamples/projects/build-watch/node_modules/angular-cli/commands/build.js:50:26)
    at Class.<anonymous> (/Users/jonathansamples/projects/build-watch/node_modules/angular-cli/lib/models/command.js:152:17)
    at tryCatch (/Users/jonathansamples/projects/build-watch/node_modules/rsvp/dist/lib/rsvp/-internal.js:215:12)
    at invokeCallback (/Users/jonathansamples/projects/build-watch/node_modules/rsvp/dist/lib/rsvp/-internal.js:230:13)
    at publish (/Users/jonathansamples/projects/build-watch/node_modules/rsvp/dist/lib/rsvp/-internal.js:198:7)
    at flush (/Users/jonathansamples/projects/build-watch/node_modules/rsvp/dist/lib/rsvp/asap.js:85:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
1 (urgent) bufix

Most helpful comment

@denkomanceski @jonnysamps to get around this run the following:
ng build --watch -o dist/ Adding the out param seems to fix it. We use it as well because we proxy the site and need physical files on disk.

All 5 comments

same happens on Windows. There is one main reason why we would use ng build -watch over ng serve.. we need the generated map files on the disk instead of in-memory on the webpack dev server so we will be able to debug from webstorm..

@denkomanceski @jonnysamps to get around this run the following:
ng build --watch -o dist/ Adding the out param seems to fix it. We use it as well because we proxy the site and need physical files on disk.

Good tip @splintercode. Works like a charm.

Unfortunately it does not seem to work for me.

I have a directory called test. Inside this directory are two other directories. One for my electron program and the other an angular app built using ng new.

Now I've set my angular-cli.json to output to "outDir": "../electron/src/gui"

When I do a normal ng build, it creates the files as it should. However if I use ng build --watch with that directory and change anything, it does not update anything.

Btw: I am using windows7 64bit

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