gpt4 book ai didi

javascript - Angular2 构建过程失败

转载 作者:太空狗 更新时间:2023-10-29 18:21:52 26 4
gpt4 key购买 nike

我正在尝试构建 https://github.com/angular/angular掌握如build steps中所述.当我吞下 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'.

我没有安装 Protractor 和 Chrome Canary,但我认为它们没有关系。至少几周前,没有他们,它的 build 还不错。

我还尝试将 require('typescript-require');( https://github.com/eknkc/typescript-require ) 放入 gulpfile 中,但没有成功。

非常感谢您的帮助。

最佳答案

对我来说,解决这个错误的方法是手动安装类型定义:

cd tools 
tsd install

关于javascript - Angular2 构建过程失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30549163/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com