aws sdk:从angular5更新到angular6后崩溃
我刚从Angular 5.2更新到Angular 6.0,我的代码现在出现以下错误:aws sdk:从angular5更新到angular6后崩溃,angular,amazon-web-services,typescript,aws-sdk,Angular,Amazon Web Services,Typescript,Aws Sdk,我刚从Angular 5.2更新到Angular 6.0,我的代码现在出现以下错误: core.js:1601 ERROR Error: Uncaught (in promise): ReferenceError: global is not defined ReferenceError: global is not defined at Object../node_modules/buffer/index.js (index.js:43) at __webpack_require__ (bo
core.js:1601 ERROR Error: Uncaught (in promise): ReferenceError: global is
not defined
ReferenceError: global is not defined
at Object../node_modules/buffer/index.js (index.js:43)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserHashUtils.js
(browserHashUtils.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserHmac.js (browserHmac.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserCryptoLib.js
(browserCryptoLib.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browser_loader.js (browser_loader.js:4)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/buffer/index.js (index.js:43)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserHashUtils.js
(browserHashUtils.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserHmac.js (browserHmac.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browserCryptoLib.js
(browserCryptoLib.js:1)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/aws-sdk/lib/browser_loader.js (browser_loader.js:4)
at __webpack_require__ (bootstrap:81)
有人知道这个问题吗?
我尝试了ng更新,但似乎aws sdk js没有提供更新的示意图
ReferenceError:未定义全局
修理
发件人:节点垫片已在6.0中移除
解决方案:正在破坏的代码就是问题所在。至少这是从角度看的姿态。例如,向aws sdk等报告。在解决此问题之前,有一个解决方法
尝试在index.html头标记中添加以下内容
<script>
if (global === undefined) {
var global = window;
}
</script>
如果(全局===未定义){
var全局=窗口;
}
将以下内容添加到polyfills.ts
// aws-sdk requires global to exist
(window as any).global = window;
根据本文件(并由我测试):
您只需将此行添加到polyfills.ts文件的顶部:
(window as any).global = window;
这应该可以解决问题,而且是正确的解决方法 此外,当您的框架没有polyfills.ts文件时,ember cli:3.15.2