我正在尝试使用MeteorChef网站上的示例
https://themeteorchef.com/tutorials/server-side-routing-with-picker#!
这是我的服务器服务器端代码:
var bodyParser = require('body-parser')
Picker.middleware( bodyParser.json() );
// Define our routes.
Picker.route('/tester', function (params, request, response, next) {
// Now we have access to request.body!
console.log(request.body);
});
但是我在控制台中收到以下错误
W20180628-11:34:29.786(-5)? (STDERR) /home/insider/.meteor/packages/meteor-tool/.1.7.0_3.5jlc5e.4sxk++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20180628-11:34:29.787(-5)? (STDERR) throw(ex);
W20180628-11:34:29.787(-5)? (STDERR) ^
W20180628-11:34:29.788(-5)? (STDERR)
W20180628-11:34:29.788(-5)? (STDERR) TypeError: bodyParser.json is not a function
W20180628-11:34:29.788(-5)? (STDERR) at uploader.js (imports/startup/server/uploader.js:3:31)
在Meteor 1.6.0.1 中工作正常,但是升级到 1.7.0.3 后停止工作,我只是尝试了其他npm软件包,但仍然收到相同的错误,感谢您的支持帮助。