我有一个简单的nodejs字典应用程序,它使用webpack进行客户端模块管理和脚本连接。在我的本地机器上一切正常。现在我正在使用Azure中的CI进行一些实验。在使用来自visualstudio.com的CI的Azure连续交付选项的实验期间,我在执行webpack任务时遇到以下错误(我正在使用来自市场的webpack任务)。任何人都可以帮助我吗?
webpack构建任务特定的日志文件说:
2017-07-31T13:44:16.2307812Z ##[section]Starting: webpack
2017-07-31T13:44:16.2307812Z ==============================================================================
2017-07-31T13:44:16.2307812Z Task : webpack
2017-07-31T13:44:16.2307812Z Description : bundle your assets, scripts, images, styles
2017-07-31T13:44:16.2307812Z Version : 3.0.19
2017-07-31T13:44:16.2307812Z Author : Dealogic
2017-07-31T13:44:16.2307812Z Help : [More information](https://marketplace.visualstudio.com/items?itemName=Dealogic.webpack-vsts-extension) [webpack](https://webpack.github.io/)
2017-07-31T13:44:16.2307812Z ==============================================================================
2017-07-31T13:44:16.4428024Z webpack
2017-07-31T13:44:16.4447837Z webpackConfigLocation: ./webpack.browser.config.js
2017-07-31T13:44:16.4447837Z treatErrorsAs: warnings
2017-07-31T13:44:16.4447837Z treatWarningsAs: warnings
2017-07-31T13:44:16.4447837Z workingFolder: d:\a\1\s
2017-07-31T13:44:16.4447837Z webpackModuleLocation: null
2017-07-31T13:44:16.4457843Z webpack module resolution started
2017-07-31T13:44:16.7987854Z webpack module resolution finished
2017-07-31T13:44:16.7987854Z webpack config resolution started
2017-07-31T13:44:16.7997851Z webpack config resolution finished
2017-07-31T13:44:16.7997851Z compilation of the webpack project is started
2017-07-31T13:44:17.3707894Z
2017-07-31T13:44:17.3707894Z [at-loader] Using typescript@2.4.2 from typescript and "tsconfig.json" from d:\a\1\s\client\tsconfig.json.
2017-07-31T13:44:17.3707894Z
2017-07-31T13:44:19.1378300Z
2017-07-31T13:44:19.1378300Z [at-loader] Checking started in a separate process...
2017-07-31T13:44:19.5368391Z
2017-07-31T13:44:19.5368391Z [at-loader] Checking finished with 1 errors
2017-07-31T13:44:19.5428397Z compilation of the webpack project is done
2017-07-31T13:44:19.5498387Z Hash: 1f80fddb56bf16ebb0f6
2017-07-31T13:44:19.5498387Z Version: webpack 3.4.1
2017-07-31T13:44:19.5498387Z Time: 2631ms
2017-07-31T13:44:19.5498387Z Asset Size Chunks Chunk Names
2017-07-31T13:44:19.5498387Z app-bundle.js 146 kB 0 [emitted] main
2017-07-31T13:44:19.5498387Z app-bundle.js.map 179 kB 0 [emitted] main
2017-07-31T13:44:19.5498387Z [4] ./node_modules/inversify/lib/annotation/decorator_utils.js 2.56 kB {0} [built]
2017-07-31T13:44:19.5498387Z [5] ./node_modules/inversify/lib/utils/guid.js 352 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [7] ./node_modules/inversify/lib/inversify.js 1.93 kB {0} [built]
2017-07-31T13:44:19.5498387Z [8] ./client/src/Dependency/DependencyIdentifiers.js 395 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [11] ./node_modules/reflect-metadata/Reflect.js 48 kB {0} [built]
2017-07-31T13:44:19.5498387Z [14] ./node_modules/inversify/lib/syntax/constraint_helpers.js 1.48 kB {0} [built]
2017-07-31T13:44:19.5498387Z [15] ./node_modules/inversify/lib/planning/metadata_reader.js 962 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [16] ./client/src/index.ts 1.29 kB {0} [built]
2017-07-31T13:44:19.5498387Z [17] ./client/src/Dependency/DependencyManager.js 983 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [18] ./client/src/Services/WordFetcherImpl.js 2.18 kB {0} [built]
2017-07-31T13:44:19.5498387Z [45] ./node_modules/inversify/lib/annotation/post_construct.js 722 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [46] ./node_modules/process/browser.js 5.42 kB {0} [built]
2017-07-31T13:44:19.5498387Z [48] ./client/src/Utils/UriUtils.js 356 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [49] ./client/src/Services/OxfordHelper.js 1.29 kB {0} [built]
2017-07-31T13:44:19.5498387Z [50] ./client/src/Services/DictionaryService.js 2.13 kB {0} [built]
2017-07-31T13:44:19.5498387Z + 36 hidden modules
2017-07-31T13:44:19.5498387Z
2017-07-31T13:44:19.5498387Z ERROR in [at-loader] TS2688: Cannot find type definition file for 'reflect-metadata'.
2017-07-31T13:44:19.5568407Z ##[warning]webpack partially succeeded
2017-07-31T13:44:19.5568407Z ##[warning]webpack: [at-loader] TS2688: Cannot find type definition file for 'reflect-metadata'.
2017-07-31T13:44:19.5568407Z webpack summary section markdown file creation is started
2017-07-31T13:44:19.5568407Z webpack sumamry section markdown file is created with the name 'd:\a\1\s\webpack.webpack.result.md'
2017-07-31T13:44:20.0895996Z ##[section]Finishing: webpack
以下是package.json
中的依赖项片段"dependencies": {
"async": "^2.5.0",
"compression": "^1.7.0",
"express": "^4.15.3",
"inversify": "^4.2.0",
"reflect-metadata": "^0.1.10",
"request": "^2.81.0"
},
"devDependencies": {
"@types/async": "^2.0.40",
"@types/compression": "0.0.33",
"@types/express": "^4.0.36",
"@types/jasmine": "^2.5.53",
"@types/node": "^8.0.14",
"@types/request": "^2.0.0",
"awesome-typescript-loader": "^3.2.1",
"jasmine": "^2.6.0",
"jasmine-console-reporter": "^1.2.7",
"typescript": "*",
"typings": "^2.1.1",
"webpack": "^3.0.0"
}
可能有什么不对?
答案 0 :(得分:0)
尝试安装reflect-metadata @types:https://www.npmjs.com/package/@types/reflect-metadata
npm i -D @types/reflect-metadata
也许你应该在tsconfig.json上添加它,取决于你当前的配置。
答案 1 :(得分:0)
这更像是一个MS TFS问题。当我将Agent从“Hosted VS2017”更改为“Hosted Linux Preview”时,一切正常!
不确定幕后发生了什么。