在 Meteor 中使用 Picker / body-parser npm 包时出错

Error using Picker / body-parser npm package in Meteor

尝试在 Meteor 服务器端 运行 这段代码,找不到开始调试的方法...我认为我不需要为此创建一个 lib 文件夹?

import bodyParser from 'body-parser';
import { Picker } from 'meteor/meteorhacks:picker';

Picker.middleware(bodyParser.json());

错误:

Error: Cannot find module './lib/types/json'

有什么想法吗?

你应该通过 atmosphere

安装选择器
meteor add meteorhacks:picker

检查是否一切正常执行

grep meteorhacks:picker .meteor/packages

第二个包应该从 npm 存储库

安装
yarn add body-parser

检查是否一切正常执行

grep body-parser package.json

如果问题还是没有解决可以简单的"clear cache"

rm -rf node_modules
yarn

但老实说,我建议使用 express 而不是 picker,因为它似乎被遗弃了。 express 与 meteor 集成教程:

http://www.mhurwi.com/meteor-with-express/