在尝试使用typescript和npm运行我的Angular2应用程序时,我收到了标题中的错误。正如在类似主题中所说,我尝试了“import”reflect-metadata';“ 但它没有用。
这是我的package.json文件中的依赖项:
"reflect-metadata": "0.1.3",
提前感谢您的时间
P.S:这是在我将我的应用程序从rc4升级到rc5
之后发生的修改1
有关错误的更多详细信息:
checkReflect @ vendor.js:40700
(anonymous function) @ vendor.js:40702
(anonymous function) @ vendor.js:40791
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:30176
(anonymous function) @ vendor.js:30215
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:30634
(anonymous function) @ vendor.js:30652
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:37326
(anonymous function) @ vendor.js:37842
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:36288
(anonymous function) @ vendor.js:37305
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:26058
(anonymous function) @ vendor.js:26118
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:9935
(anonymous function) @ vendor.js:10294
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:12761
(anonymous function) @ vendor.js:12871
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:12255
(anonymous function) @ vendor.js:12657
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:12907
(anonymous function) @ vendor.js:12935
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:12885
(anonymous function) @ vendor.js:12892
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:6709
(anonymous function) @ vendor.js:6746
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ vendor.js:148
(anonymous function) @ vendor.js:49327
(anonymous function) @ vendor.js:49528
initModule @ vendor.js:43
require @ vendor.js:60
expanded @ vendor.js:34
(anonymous function) @ main.js:404
initModule @ vendor.js:43
require @ vendor.js:60
(anonymous function) @ (index):38
答案 0 :(得分:3)
当我为我的swagger生成的客户端代码升级为休息终点时,我发现angular 4.1.3
cli
reflect-metadata
版本存在同样的问题(swagger编辑器2.2.3)。
我添加了angular 4
,它对我有用。任何人在cli
之后面对此问题并拥有_fails.js:1 Uncaught SyntaxError: Unexpected identifier
at Object../node_modules/core-js/modules/_descriptors.js (_descriptors.js:2)
at __webpack_require__ (bootstrap aaad282eb132f1a48d07:54)
at Object../node_modules/core-js/modules/es6.symbol.js (es6.symbol.js:5)
at __webpack_require__ (bootstrap aaad282eb132f1a48d07:54)
at Object../node_modules/core-js/es6/symbol.js (polyfills.bundle.js:1560)
at __webpack_require__ (bootstrap aaad282eb132f1a48d07:54)
at Object../src/polyfills.ts (ckset.ts:17)
at __webpack_require__ (bootstrap aaad282eb132f1a48d07:54)
at Object.2 (polyfills.bundle.js:13849)
at __webpack_require__ (bootstrap aaad282eb132f1a48d07:54)
core.es5.js:354 Uncaught reflect-metadata shim is required when using class decorators
可能会有所帮助。
错误消息与下面的
略有不同'start_time'
答案 1 :(得分:1)
控制台中应该有错误解释未加载reflect-metadata
的原因。
0.1.3存在的问题是模块化系统(SystemJS,Webpack等)可能错误地包含conditional dependencies。如果脚本以正常方式加载,则不会发生这种情况,
<script src="https://npmcdn.com/reflect-metadata@0.1.3"></script>
以后的软件包版本应该用于reflect-metadata
模块化系统,目前可以使用0.1.8。