【IT专家】将Lob Node API包装器与MeteorJs集成
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
本文由我司收集整编,推荐下载,如有疑问,请与我司联系
将Lob Node API包装器与MeteorJs集成
将Lob Node API包装器与MeteorJs集成- 问题与需求(’fs’)[英]Integrating Lob Node API wrapper with MeteorJs - Issue with require(‘fs’) I’m using Meteor 1.13 (Latest version) and they’ve added NPM support recently. So I added in the Lob NPM. I began to make a letter function and I get this error:
我正在使用Meteor 1.13(最新版本),他们最近添加了NPM支持。
因此我在Lob NPM中添加了。
我开始写一个字母函数,我得到这个错误:
Uncaught TypeError: fs.readdirSync is not a function
未捕获的TypeError:fs.readdirSync不是函数
This is what my function looks like:
这就是我的功能:
import { Meteor } from ‘meteor/meteor’;import ‘lob’;Meteor.methods({sendLetter(name) { Lob.letters.create({ description: ‘Garrison Snelling’, to: { name: name, address_line1: ‘123 Test Street’, address_city: ‘Mountain View’, address_state: ‘CA’, address_zip: ‘94041’, address_country: ‘US’, from: { name: ‘Ami Wang’, address_line1: ‘123 Test Avenue’, address_city: ‘Mountain View’, address_state: ‘CA’, address_zip: ‘94041’, address_country: ‘US’, file: ‘ html HTML Letter for {{name}} /html ‘, data: { name: ‘Harry’ color: true }, function (err, res) { console.log(err, res); .then(function (res) { console.log(‘The Lob API responded with this letter object: ‘, res);I’ve tried including ‘fs’ manually, but no luck... I’ve tried:
我试过手动包含’fs’,但没有运气......我试过了:
var fs = require(‘fs’); // Didn’t fail, but got same errorconst fs = require(‘fs’); // Didn’t fail, but got same error var fs = Npm.require(‘fs’); // Didn’t fail, but got same errorvar fs = npm.require(‘fs’); // Failedvar fs = Meteor.require(‘fs’); None of these worked! Any help on what is going on here would help.. Thanks!
这些都没有奏效!任何关于这里发生的事情的帮助都会有所帮助..谢谢!。