【发布时间】:2018-11-02 15:25:11
【问题描述】:
当我导入 Paypal-Rest-SDK 并尝试运行时:
react-native run-android
发生错误:
"undefined is not a function(evaluating 'r(d[9]).configure')"
在发生此错误之前,我删除了node_modules 文件夹并再次重新安装了所有模块,因为我在“评估 process.versions.openssl”时遇到了类似的错误。当我调用node -p process.versions 时,会打印以下内容:
{ http_parser: '2.8.0',
node: '8.12.0',
v8: '6.2.414.66',
uv: '1.19.2',
zlib: '1.2.11',
ares: '1.10.1-DEV',
modules: '57',
nghttp2: '1.32.0',
napi: '3',
openssl: '1.0.2p',
icu: '60.1',
unicode: '10.0',
cldr: '32.0',
tz: '2017c' }
我的代码如下使用 paypal-sdk:
'use strict';
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, TouchableHighlight, Linking} from 'react-native';
var paypal = require('paypal-rest-sdk');
paypal.configure({
mode: 'sandbox', // Sandbox or live
client_id: 'x',
client_secret: 'y'});
export default class Paypal extends Component{
constructor(props)
{
super(props);
console.log(process);
}
render()
{
return(
<View>
<Text>This is gonna be a PayPal Thing</Text>
</View>
);
}
}
我希望有人可以帮助我。我几乎整天都在谷歌上搜索这个问题。
更新: 问题不是 paypal-rest-sdk 的包含,而是当我尝试配置 paypal 变量时的下一行。当我将它们注释掉时,错误消失了......但据我所知,有必要配置它
更新2号 运行后 npm install --save paypal-rest-sdk 我又来解决问题了
undefined is not an object (evaluating 'process.versions.openssl')
【问题讨论】:
标签: react-native paypal-rest-sdk