我正在尝试按照 构建步骤中的描述构建https://github.com/angular/angular master 。当我 gulp build.js 时,我最终得到了这个错误:
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'.
我没有安装量角器和 Chrome Canary,但我认为它们无关。至少几周前,没有它们,它的建设还不错。
我还尝试在这里和那里将 require('typescript-require');( https://github.com/eknkc/typescript-require ) 放入 gulpfile 但没有任何成功。
因此,我们非常感谢您的帮助。