Javascript AWS JS SDK抛出未捕获的TypeError:无法读取属性';加密';未定义的
我的代码如下:Javascript AWS JS SDK抛出未捕获的TypeError:无法读取属性';加密';未定义的,javascript,amazon-web-services,aws-sdk,Javascript,Amazon Web Services,Aws Sdk,我的代码如下: var AWS = require('./aws-sdk-2.2.10.js') // THIS LINE ERRORS 产生以下错误: Uncaught TypeError: Cannot read property 'crypto' of undefined 这是aws-sdk-2.2.10.js中引发错误的部分 ... 65: [function(require, module, exports) { (function() { var _global
var AWS = require('./aws-sdk-2.2.10.js') // THIS LINE ERRORS
产生以下错误:
Uncaught TypeError: Cannot read property 'crypto' of undefined
这是aws-sdk-2.2.10.js中引发错误的部分
...
65: [function(require, module, exports) {
(function() {
var _global = this; // I think 'this' is undefined here
var mathRNG, whatwgRNG;
mathRNG = function(size) {
var bytes = new Array(size);
var r;
for (var i = 0, r; i < size; i++) {
if ((i & 0x03) == 0)
r = Math.random() * 0x100000000;
bytes[i] = r >>> ((i & 0x03) << 3) & 0xff;
}
return bytes;
}
;
if (_global.crypto && crypto.getRandomValues) { // THIS LINE ERRORS
whatwgRNG = function(size) {
var bytes = new Uint8Array(size);
crypto.getRandomValues(bytes);
return bytes;
}
;
}
module.exports = whatwgRNG || mathRNG;
}
)();
}
...
。。。
65:[功能(要求、模块、导出){
(功能(){
var _global=this;//我认为这里没有定义this
var mathRNG,whatwgRNG;
mathRNG=函数(大小){
var bytes=新数组(大小);
var-r;
对于(变量i=0,r;i bytes[i]=r>>>>((i&0x03)嗨。我也遇到了同样的问题,你是否设法解决了这个问题?@JorgeChayan我没有:(我发现了这个问题,显然AWS SDK使用了CyptoJS,我丢失了这个库中“components”子目录下的“core.js”文件。我刚刚添加了它,瞧a.c: