Skip to content

ng build -w does not work #2409

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
goriunov opened this issue Sep 29, 2016 · 4 comments
Closed

ng build -w does not work #2409

goriunov opened this issue Sep 29, 2016 · 4 comments

Comments

@goriunov
Copy link

OS?

Mac OSX El Capitan

Versions.

angular-cli: 1.0.0-beta.16
node: 6.5.0

$ ng build -w
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
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/goriunov/Desktop/GitHub Repos/multiplayr-game/front-end/node_modules/angular-cli/tasks/build-webpack-watch.js:14:26)
at Class.run (/Users/goriunov/Desktop/GitHub Repos/multiplayr-game/front-end/node_modules/angular-cli/commands/build.js:50:26)
at Class. (/Users/goriunov/Desktop/GitHub Repos/multiplayr-game/front-end/node_modules/angular-cli/lib/models/command.js:152:17)
at tryCatch (/Users/goriunov/Desktop/GitHub Repos/multiplayr-game/front-end/node_modules/rsvp/dist/lib/rsvp/-internal.js:215:12)
at invokeCallback (/Users/goriunov/Desktop/GitHub Repos/multiplayr-game/front-end/node_modules/rsvp/dist/lib/rsvp/-internal.js:230:13)
at publish (/Users/goriunov/Desktop/GitHub Repos/multiplayr-game/front-end/node_modules/rsvp/dist/lib/rsvp/-internal.js:198:7)
at flush (/Users/goriunov/Desktop/GitHub Repos/multiplayr-game/front-end/node_modules/rsvp/dist/lib/rsvp/asap.js:82:5)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

@softmodal
Copy link

I'm new to this project, but it looks like commandOptions.outputPath is getting removed somewhere along the way. I'm able to work around it in the meantime by explicitly setting the output-path flag:

ng build --w --output-path="dist"

@lucasvfventura
Copy link

This is the line in the file build-webpack-watch.js where the error occurs:

rimraf.sync(path.resolve(project.root, runTaskOptions.outputPath));

In the file build-webpack we can see that the outputPath is set to the outDir of the angular-cli.json:

var outputDir = runTaskOptions.outputPath || config_1.CliConfig.fromProject().config.apps[0].outDir;

So to fix this issue just add these three lines of code to build-webpack-watch.js:

var config_1 = require('../models/config');
...
var outputDir = runTaskOptions.outputPath || config_1.CliConfig.fromProject().config.apps[0].outDir;
rimraf.sync(path.resolve(project.root, outputDir));

@filipesilva
Copy link
Contributor

filipesilva commented Sep 30, 2016

Dupe of #2006

@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

4 participants