Javascript 条纹。TypeError:document.querySelectorAll不是函数

Javascript 条纹。TypeError:document.querySelectorAll不是函数,javascript,node.js,meteor,stripe-payments,Javascript,Node.js,Meteor,Stripe Payments,我正在使用Meteor框架和React 添加了@stripe包。付款表单可以工作,但它会在日志中不断显示以下内容: UnhandledPromiseRejectionWarning: TypeError: document.querySelectorAll is not a function at findScript (/project/node_modules/@stripe/stripe-js/dist/stripe.js:9:26) at /project/node_modules/@s

我正在使用Meteor框架和React

添加了@stripe包。付款表单可以工作,但它会在日志中不断显示以下内容:

UnhandledPromiseRejectionWarning: TypeError: document.querySelectorAll is not a function
at findScript (/project/node_modules/@stripe/stripe-js/dist/stripe.js:9:26)
at /project/node_modules/@stripe/stripe-js/dist/stripe.js:75:20
at new Promise (<anonymous>)
at loadScript (/project/node_modules/@stripe/stripe-js/dist/stripe.js:57:19)
at /project/node_modules/@stripe/stripe-js/dist/stripe.js:113:10
at /.meteor/packages/promise/.0.11.2.1e1wn8z.joczg++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40
UnhandledPromisejectionWarning:TypeError:document.querySelectorAll不是函数
在findScript(/project/node_modules/@stripe/stripe js/dist/stripe.js:9:26)
at/project/node_modules/@stripe/stripe js/dist/stripe.js:75:20
在新的承诺()
在loadScript(/project/node_modules/@stripe/stripe js/dist/stripe.js:57:19)
at/project/node_modules/@stripe/stripe js/dist/stripe.js:113:10
at/.meteor/packages/promise/.0.11.2.1e1wn8z.joczg++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor promise/fiber_pool.js:43:40

如何解决此问题?

这似乎是您在服务器上看到的错误(否则将不会显示
节点模块路径)。因此,您似乎正在尝试在服务器端渲染条带窗体。这将不起作用,因为,是的,该功能在服务器上不存在。我认为您最好的选择是在使用此条带表单的react组件中添加一个保护。大概是这样的:

constMyPaymentForm=(道具)=>{
if(Meteor.isServer){
返回条带表单将在客户端动态加载;
}
提供
...
;
};

客户端版本上的
suppressHyderationWarning
参数是为了避免在客户端上水合与从服务器返回的HTML形状不同的HTML时出现(常见)React错误。

这似乎是您在服务器上看到的错误(否则将不会显示
节点模块路径)。因此,您似乎正在尝试在服务器端渲染条带窗体。这将不起作用,因为,是的,该功能在服务器上不存在。我认为您最好的选择是在使用此条带表单的react组件中添加一个保护。大概是这样的:

constMyPaymentForm=(道具)=>{
if(Meteor.isServer){
返回条带表单将在客户端动态加载;
}
提供
...
;
};

客户端版本上的
suppressHyderationWarning
参数是为了避免在客户端上添加与从服务器返回的形状不同的HTML时出现(常见)React错误。

是否使用旧浏览器?像真的很老吗?你真的认为没有代码我们可以做任何事情吗,展示你的承诺。您可能没有访问文档对象的范围,应该将其作为参数传递。是否使用旧浏览器?像真的很老吗?你真的认为没有代码我们可以做任何事情吗,展示你的承诺。您可能没有到达document对象的范围,应该将其作为参数传递。