我试图使用node.js控制台编写一个关于realm-js的小测试,但在插入te第一个字符串之后,我看到了一个例外:
> var Realm = require('realm')
TypeError: utf8 is not a function
at Function.from (native)
at Function.from (native)
at module.exports (/home/hermann/node_modules/realm/lib/submit-analytics.js:92:60)
at Object.<anonymous> (/home/hermann/node_modules/realm/lib/index.js:70:42)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
任何人都可以帮我解决这个问题吗?
UPD。在此调用中,realm / lib / submit-analytics.js中发生错误:
request(`https://api.mixpanel.com/track/?data=${Buffer.from(JSON.stringify(payload), 'utf8').toString('base64')}&ip=1`,
() => { /* Analytics failed. Do nothing. */ });