gpt4 book ai didi

node.js - 如何通过meteorhacks npm正确使用 Node 模块

转载 作者:太空宇宙 更新时间:2023-11-03 22:53:50 24 4
gpt4 key购买 nike

第一次尝试将 Node 模块与meteor一起使用

已安装:

meteor add meteorhacks:npm

然后安装:

npm install multer

服务器目录中有一个单独的文件,名为“loadMulter”,其中只有一行:

var multer = Meteor.npmRequire('multer');

现在,运行“meteor”并收到此错误:

W20150609-12:22:56.528(-5)? (STDERR)          
W20150609-12:22:56.528(-5)? (STDERR) /home/eugene/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20150609-12:22:56.529(-5)? (STDERR) throw(ex);
W20150609-12:22:56.529(-5)? (STDERR) ^
W20150609-12:22:56.531(-5)? (STDERR) ReferenceError: require is not defined
W20150609-12:22:56.531(-5)? (STDERR) at app/node_modules/multer/node_modules/busboy/node_modules/dicer/node_modules/streamsearch/lib/sbmh.js:5:20
W20150609-12:22:56.531(-5)? (STDERR) at app/node_modules/multer/node_modules/busboy/node_modules/dicer/node_modules/streamsearch/lib/sbmh.js:215:3
W20150609-12:22:56.531(-5)? (STDERR) at /home/eugene/dev/meteor/socially/.meteor/local/build/programs/server/boot.js:222:10
W20150609-12:22:56.531(-5)? (STDERR) at Array.forEach (native)
W20150609-12:22:56.532(-5)? (STDERR) at Function._.each._.forEach (/home/eugene/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20150609-12:22:56.532(-5)? (STDERR) at /home/eugene/dev/meteor/socially/.meteor/local/build/programs/server/boot.js:117:5

将这些东西组合在一起的正确方法是什么?

最佳答案

请勿使用 npm installnpm 软件包安装为本地 node_module

您需要在添加 meteorhacks:npm 并启动 Meteor 后创建的名为 package.json 的特殊文件中指定所需的包。

{
"multer": "0.1.8"
}

https://github.com/meteorhacks/npm#defining-packages

关于node.js - 如何通过meteorhacks npm正确使用 Node 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30738896/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com