每当我尝试在 Node.js 中使用 png-js 时,都会收到这个奇怪的错误:
/home/anderson/node_modules/png-js/png-node.js:152
b1 = this.data[this.pos++] << 24;
^
TypeError: Cannot read property '8' of undefined
at PNG.readUInt32 (/home/anderson/node_modules/png-js/png-node.js:152:21)
at new PNG (/home/anderson/node_modules/png-js/png-node.js:56:26)
at /home/anderson/node_modules/png-js/png-node.js:34:15
at [object Object].<anonymous> (fs.js:88:5)
at [object Object].emit (events.js:67:17)
at Object.oncomplete (fs.js:1059:12)
这是产生此输出的程序:
var PNG = require('png-js');
PNG.decode('some.png', function(pixels) {
// pixels is a 1d array of decoded pixel data
});
过去,我可以毫无问题地使用 png-js 模块。这个模块是否可能与我安装的另一个 node.js 模块冲突?