首页 > 解决方案 > 错误:错误:无法解析模块操作系统

问题描述

每当我尝试在我的设备上运行我的 react 本机应用程序进行测试时,我都会收到错误“无法解析模块操作系统”错误我正在尝试使用 nodemailer 和谷歌 Oauth 测试发送电子邮件,但我无法解决该错误,在这里下面是我的代码

应用程序.js

try{
        const accessToken = await oAuthClient.getAccessToken();
        const authOptions = {
            service: 'gmail',
            auth: {
                type: 'OAuth2',
                user: 'user@gmail.com',
                clientId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
                clientSecret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
                refreshToken: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
                accessToken: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
            }
            
        };
        let transport = nodemailer.createTransport(authOptions);
        const data = {
            from: 'fromemail <fromemail@example.com>',
            to: 'to@gexample.com',
            subject: 'testing email',
            text: 'Testing Email!',
            html: '<h1>testing email </h1>'
        }
        const result = await transport.sendMail(data);
        return result;       
    }catch(error){
        return error;
    }

在此处输入图像描述 我的设备出错

在此处输入图像描述 我的地铁捆绑器中的错误

标签: react-native-androidnodemailer

解决方案


推荐阅读