使用此文档时遇到问题:https://github.com/VeliovGroup/Meteor-Files/wiki/Image-Processing。本文档指导为pakage Meteor-File
创建缩略图我安装了所有需要包的指导,但是当我运行代码时,它有一个问题:
Uncaught TypeError: Cannot read property 'prototype' of undefined
at patch (modules.js?hash=b849b729a9c5ee343b208254dca34d866ee59991:19084)
at graceful-fs.js (modules.js?hash=b849b729a9c5ee343b208254dca34d866ee59991:18945)
at fileEvaluate (modules-runtime.js?hash=8587d188e038b75ecd27ed2469a52b269e38fb62:343)
at require (modules-runtime.js?hash=8587d188e038b75ecd27ed2469a52b269e38fb62:238)
at index.js (modules.js?hash=b849b729a9c5ee343b208254dca34d866ee59991:16785)
at fileEvaluate (modules-runtime.js?hash=8587d188e038b75ecd27ed2469a52b269e38fb62:343)
at require (modules-runtime.js?hash=8587d188e038b75ecd27ed2469a52b269e38fb62:238)
at index.js (modules.js?hash=b849b729a9c5ee343b208254dca34d866ee59991:16624)
at fileEvaluate (modules-runtime.js?hash=8587d188e038b75ecd27ed2469a52b269e38fb62:343)
at require (modules-runtime.js?hash=8587d188e038b75ecd27ed2469a52b269e38fb62:238)
我按照跟踪,在这里找到了原型:
var fs$ReadStream = fs.ReadStream
ReadStream.prototype = Object.create(fs$ReadStream.prototype)
ReadStream.prototype.open = ReadStream$open
' FS' lib正在这里使用:
import fs from 'fs-extra';
请帮助我!
答案 0 :(得分:1)
也许你应该尝试这样的事情?
var fs$ReadStream = fs.ReadStream
fs.ReadStream.prototype = Object.create(fs$ReadStream.prototype)
fs.ReadStream.prototype.open = ReadStream$open
希望它有所帮助。
答案 1 :(得分:0)
我只使用内置节点fs
模块而不是fs-extra
解决了这个问题。到目前为止没有任何问题。
答案 2 :(得分:0)
'fs'lib在服务器端可用。所以只需将这些代码包装在块中:
if (Meteor.isServer()){
//use fs lib
}
或将代码文件切换到服务器的文件夹。 它会工作正常!