在安装Maverick之前,我的应用运行良好。在我在终端输入nodemon app.js
后安装Maverick后,它不再有效,所以我重新安装了节点然后
npm uninstall nodemon
后跟npm install nodemon
重新安装。这很好用,nodemon现在可以工作了。不幸的是现在我有了一个我无法解决的新bug。在我的应用中上传图片时,我得到了
TypeError: Cannot read property 'width' of undefined
var gm = require('gm').subClass({ imageMagick: true });
gm(target_path).size(function (err, size) {//shrinks and replaces large images
if (size.width > 700 || size.height > 700) {
gm(target_path).scale(700, 700).autoOrient().write(target_path, function (err) {
if (!err) console.log('shrunk! ');
});
}
});
如果我将其评论出来,然后只需加载带有图像的页面,我就可以
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)
2 Oct 17:30:21 - [nodemon] app crashed - waiting for file changes before starting...
我已经卸载并树脂化了fs,gm,imagemagick,jquery,以及几乎所有模块都没有成功。 usr/local/lib/node_modules
内有以下内容
并在我的项目中的node_modules
目录中减去节点和npm。
$ ls
bcrypt-nodejs consolidate express fs gm imagemagick jquery mongodb node-fs nodemon npm
仍然这样:
/Users/Squirrel/Documents/Code/Memry/Memry_11-8/routes/content.js:605
if (size.width > 700 || size.height > 700) {
^
TypeError: Cannot read property 'width' of undefined
at gm.<anonymous> (/Users/Squirrel/Documents/Code/Memry/Memry_11-8/routes/content.js:605:15)
at gm.emit (events.js:106:17)
at gm.<anonymous> (/Users/Squirrel/Documents/Code/Memry/Memry_11-8/node_modules/gm/lib/getters.js:70:16)
at cb (/Users/Squirrel/Documents/Code/Memry/Memry_11-8/node_modules/gm/lib/command.js:265:16)
at ChildProcess._spawn.proc.on.onExit (/Users/Squirrel/Documents/Code/Memry/Memry_11-8/node_modules/gm/lib/command.js:247:9)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Socket.<anonymous> (child_process.js:969:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
3 Oct 11:58:43 - [nodemon] app crashed - waiting for file changes before starting..