# StealJS build watch, fails to rebuild most of the time

**URL:** <https://forums.bitovi.com/t/stealjs-build-watch-fails-to-rebuild-most-of-the-time/499>\
**Category:** StealJS\
**Created:** [December 9, 2016, 8:44pm UTC](https://forums.bitovi.com/t/stealjs-build-watch-fails-to-rebuild-most-of-the-time/499 "2016-12-09T20:44:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nothing\_New](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/nothing_new/32/206_2.png) [@Nothing\_New](https://forums.bitovi.com/u/Nothing_New)\
**Post date:** [December 9, 2016, 8:44pm UTC](https://forums.bitovi.com/t/stealjs-build-watch-fails-to-rebuild-most-of-the-time/499/1 "2016-12-09T20:44:14Z")

</div>

When I run node build on this it works the first time. Then when I modify some code that is being built. Build watch fails most of the time to build properly and I get errors.

It works usually the first 2 times.

```
var stealTools = require("steal-tools");

stealTools.build( {
    config: __dirname + "/package.json!npm",
}, {
    sourceMaps: true,
    bundleSteal: true,
    minify: false,
    watch: true
} );

```

Most of the time I get this error in the browser.

```
Failed to load resource: the server responded with a status of 404 (Not Found)
main.js?version=f82b611…:6370Error loading "package.json!npm" at <unknown>
Error loading "npm" at http://dev.drivetrain.com/npm.js
Not Found: http://dev.drivetrain.com/npm.js undefined

```

The code that throws this error, in my main.js that gets built in the /dist/ folder, that I am including.

```
var oldSteal = global.steal;
		global.steal = makeSteal(System);
		global.steal.startup(oldSteal && typeof oldSteal == 'object' && oldSteal)
			.then(null, function(error){
				if(typeof console !== "undefined") {
					// Hide from uglify
					var c = console;
					var type = c.error ? "error" : "log";
					c[type](error, error.stack);
				}
			});
		global.steal.clone = cloneSteal;
		global.steal.addSteal = addSteal;

```

Terminal throws this in yellow.  
`WARNING: Can't find dependency package.json!npm in graph.`

Sometimes I get an error that says something along the lines of System is not defined, I couldn’t recreate it this time, but it happens quite often.

This is not caused by a syntax error in the code that I am editing, this happens even if I edit the text of a comment, or even a .stache template.

Thanks!

---

<div class="post-metadata">

**Author:** ![matthewp](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/matthewp/32/77_2.png) [@matthewp](https://forums.bitovi.com/u/matthewp)\
**Post date:** [December 12, 2016, 9:07pm UTC](https://forums.bitovi.com/t/stealjs-build-watch-fails-to-rebuild-most-of-the-time/499/2 "2016-12-12T21:07:20Z")

</div>

Hey @Nothing_New, I don’t think you’re doing anything wrong here. It seems like it’s probably a bug. I would suggest posting an issue on steal-tools about this.

---

<div class="post-metadata">

**Author:** ![Nothing\_New](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/nothing_new/32/206_2.png) [@Nothing\_New](https://forums.bitovi.com/u/Nothing_New)\
**Post date:** [December 12, 2016, 9:14pm UTC](https://forums.bitovi.com/t/stealjs-build-watch-fails-to-rebuild-most-of-the-time/499/3 "2016-12-12T21:14:04Z")

</div>

Thanks for the reply. StealJs does not have it’s own forum, this looks like the forum for StealJs.

Thanks!

---

<div class="post-metadata">

**Author:** ![chasen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/chasen/32/402_2.png) [@chasen](https://forums.bitovi.com/u/chasen)\
**Post date:** [December 12, 2016, 9:22pm UTC](https://forums.bitovi.com/t/stealjs-build-watch-fails-to-rebuild-most-of-the-time/499/4 "2016-12-12T21:22:34Z")

</div>

Hey @Nothing_New, here’s the repo that @matthewp mentioned: [https://github.com/stealjs/steal-tools/issues](https://github.com/stealjs/steal-tools/issues)

---

<div class="post-metadata">

**Author:** ![Nothing\_New](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/nothing_new/32/206_2.png) [@Nothing\_New](https://forums.bitovi.com/u/Nothing_New)\
**Post date:** [December 13, 2016, 2:34am UTC](https://forums.bitovi.com/t/stealjs-build-watch-fails-to-rebuild-most-of-the-time/499/5 "2016-12-13T02:34:47Z")

</div>

[https://github.com/stealjs/steal-tools/issues/571](https://github.com/stealjs/steal-tools/issues/571)
