Angular2 build process fails

Question!

I'm trying to build https://github.com/angular/angular master as described in the build steps. When I gulp build.js, I end up with this error:

gulp build.js
Dart SDK detected
[20:10:31] Using gulpfile ~/dvl/mongo/angular2/gulpfile.js
[20:10:31] Starting 'build/clean.js'...
[20:10:31] Starting 'build/clean.tools'...
[20:10:31] Finished 'build/clean.tools' after 1.34 ms
[20:10:31] Starting 'build.tools'...
[20:10:31] Starting '!build.tools'...
[20:10:31] Finished 'build/clean.js' after 174 ms
[20:10:31] Starting 'build.js.dev'...
[20:10:31] Starting 'build/clean.tools'...
[20:10:31] Finished 'build/clean.tools' after 853 μs
tools/broccoli/angular_builder.ts(1,16): error TS2304: Cannot find name 'require'.
[20:10:33] '!build.tools' errored after 1.82 s
[20:10:33] TypeScript error: tools/broccoli/angular_builder.ts(1,16): error TS2304: Cannot find name 'require'.
    at Output.getError (/home/me/dvl/mongo/angular2/node_modules/gulp-typescript/release/output.js:191:19)
    at Output.diagnostic (/home/me/dvl/mongo/angular2/node_modules/gulp-typescript/release/output.js:238:25)
    at ProjectCompiler.inputDone (/home/me/dvl/mongo/angular2/node_modules/gulp-typescript/release/compiler.js:60:33)
    at CompileStream.end (/home/me/dvl/mongo/angular2/node_modules/gulp-typescript/release/main.js:52:31)
    at DestroyableTransform.onend (/home/me/dvl/mongo/angular2/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:523:10)
    at DestroyableTransform.g (events.js:199:16)
    at DestroyableTransform.emit (events.js:129:20)
    at /home/me/dvl/mongo/angular2/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:965:16
    at process._tickCallback (node.js:355:11)
[20:10:33] 'build.tools' errored after 1.82 s
[20:10:33] Error: [object Object]
    at formatError (/opt/npm-global/lib/node_modules/gulp/bin/gulp.js:169:10)
    at Gulp.<anonymous> (/opt/npm-global/lib/node_modules/gulp/bin/gulp.js:195:15)
    at Gulp.emit (events.js:129:20)
    at Gulp.Orchestrator._emitTaskDone (/home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
    at /home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/index.js:275:23
    at finish (/home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
    at cb (/home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
    at finish (/home/me/dvl/mongo/angular2/node_modules/run-sequence/index.js:53:5)
    at Gulp.onError (/home/me/dvl/mongo/angular2/node_modules/run-sequence/index.js:60:4)
    at Gulp.emit (events.js:129:20)
[20:10:33] 'build.js.dev' errored after 1.65 s
[20:10:33] Error: [object Object]
    at formatError (/opt/npm-global/lib/node_modules/gulp/bin/gulp.js:169:10)
    at Gulp.<anonymous> (/opt/npm-global/lib/node_modules/gulp/bin/gulp.js:195:15)
    at Gulp.emit (events.js:129:20)
    at Gulp.Orchestrator._emitTaskDone (/home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
    at /home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/index.js:275:23
    at finish (/home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
    at cb (/home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
    at finish (/home/me/dvl/mongo/angular2/node_modules/run-sequence/index.js:53:5)
    at Gulp.onError (/home/me/dvl/mongo/angular2/node_modules/run-sequence/index.js:60:4)
    at Gulp.emit (events.js:129:20)
[20:10:33] 'build.js.dev' errored after 1.65 s
[20:10:33] Error: [object Object]
    at formatError (/opt/npm-global/lib/node_modules/gulp/bin/gulp.js:169:10)
    at Gulp.<anonymous> (/opt/npm-global/lib/node_modules/gulp/bin/gulp.js:195:15)
    at Gulp.emit (events.js:129:20)
    at Gulp.Orchestrator._emitTaskDone (/home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
    at /home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/index.js:275:23
    at finish (/home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
    at cb (/home/me/dvl/mongo/angular2/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
    at finish (/home/me/dvl/mongo/angular2/node_modules/run-sequence/index.js:53:5)
    at Gulp.onError (/home/me/dvl/mongo/angular2/node_modules/run-sequence/index.js:60:4)
    at Gulp.emit (events.js:129:20)
tools/broccoli/angular_builder.ts(2,11): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(3,23): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(4,20): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(5,20): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(6,12): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(7,22): error TS2304: Cannot find name 'require'.

I don't have protractor and Chrome Canary install but I don't think they're related. At least few weeks ago it was building fine without them.

I also tried to put require('typescript-require');(https://github.com/eknkc/typescript-require) into gulpfile here and there but wihout any success.

So your help is highly appreciated.



Answers

thanks to @s.Daniel for help, i summarize all my struggling with build angular2 on win machine:

1. install bower dependency Run bower install from root If you ll see error like this bower angular#1.0.6 ENOGIT git is not installed or not in the PATH then you need to specify environment variable Path like this:

set PATH=%PATH%;C:\Program Files\Git\bin

replace path with your folder's path to git.exe.

2. From your local repo go to folder angular\tools and run these commands from there: in order to install tool's dependencies,

npm install
tsd install

Without this commands you should see error like this:

error TS2304: Cannot find name 'promise' or error TS2304: Cannot find name 'require' or whatever it looking for.

3. From local repo root go to folder angular\modules\angular2 and run the same command from step 2.

npm install
tsd install

Without running this command have errors like that: Error:

[DiffingTSCompiler]: Typescript found the following errors: 
angular2/manual_typings/globals.d.ts (8, 42): Cannot find name 'Promise'

.

here:build angular 2 beta 7 on win 10



This video can help you solving your question :)
By: admin