如何修复';TypeError:process.hr时间不是函数';在nativescript中?

如何修复';TypeError:process.hr时间不是函数';在nativescript中?,nativescript,aws-amplify,nativescript-angular,Nativescript,Aws Amplify,Nativescript Angular,我正在用aws amplify构建一个nativescript(+Angular)应用程序。特别是在使用aws amplify的S3存储API时,我发现以下错误: AWSS3Provider - get signed url error TypeError: process.hrtime is not a function. (In 'process.hrtime()', 'process.hrtime' is undefined) 我正在使用以下polyfills (window as an

我正在用aws amplify构建一个nativescript(+Angular)应用程序。特别是在使用aws amplify的S3存储API时,我发现以下错误:

AWSS3Provider - get signed url error TypeError: process.hrtime is not a function. (In 'process.hrtime()', 'process.hrtime' is undefined)
我正在使用以下
polyfills

(window as any).global = window;
(window as any).process = {
  env: { DEBUG: undefined },
};
在我的代码中,我检查进程是否未定义

        if(typeof process !== 'undefined') {
        Storage.get('fileassets/asset.txt')
            .then(result => alert(result))
            .catch(err => alert(err));
        } else {
            alert("process is undefined");
        }
没有引发警报,但本机代码S3Provider似乎依赖于process.hrtime,这在nativescript非{N}环境中无法解决

我希望aws amplify API能够成功执行,因为它无法控制破解该API以避免调用process.hrtime。

{N}!==节点,并非所有节点库都使用NativeScript,但仅使用CommonJS。您应该考虑使用iOS/Android的本地库。{n}==节点,并非所有节点库都使用NativeScript,但仅使用CommonJS。您应该考虑使用iOS/Android的本机库。