我正在使用https://github.com/sw-yx/base-fcc作为基本样板,并尝试在imports/api/documents/server/methods.js
中的节点包中添加新功能。
只需添加以下一行:const getPackage = require('get-repo-package-json')
Unable to resolve some modules:
"events" in /Users/swyx/Desktop/webdev/swyx-boilerpl8/node_modules/got/index.js (web.browser)
"http" in /Users/swyx/Desktop/webdev/swyx-boilerpl8/node_modules/got/index.js (web.browser)
"https" in /Users/swyx/Desktop/webdev/swyx-boilerpl8/node_modules/got/index.js (web.browser)
"stream" in /Users/swyx/Desktop/webdev/swyx-boilerpl8/node_modules/got/index.js (web.browser)
"zlib" in /Users/swyx/Desktop/webdev/swyx-boilerpl8/node_modules/unzip-response/index.js (web.browser)
"buffer" in /Users/swyx/Desktop/webdev/swyx-boilerpl8/node_modules/safe-buffer/browser.js (web.browser)
"util" in /Users/swyx/Desktop/webdev/swyx-boilerpl8/node_modules/github-url-to-object/index.js (web.browser)
If you notice problems related to these missing modules, consider running:
meteor npm install --save meteor-node-stubs
W20170420-01:29:44.078(2)? (STDERR) packages/modules.js:398
W20170420-01:29:44.079(2)? (STDERR) let {user, repo, branch} = repoParts
W20170420-01:29:44.080(2)? (STDERR) ^
W20170420-01:29:44.080(2)? (STDERR)
W20170420-01:29:44.081(2)? (STDERR) SyntaxError: Unexpected token {
W20170420-01:29:44.081(2)? (STDERR) at Object.exports.runInThisContext (vm.js:53:16)
W20170420-01:29:44.081(2)? (STDERR) at /Users/swyx/Desktop/webdev/swyx-boilerpl8/.meteor/local/build/programs/server/boot.js:289:30
W20170420-01:29:44.082(2)? (STDERR) at Array.forEach (native)
W20170420-01:29:44.082(2)? (STDERR) at Function._.each._.forEach (/Users/swyx/.meteor/packages/meteor-tool/.1.4.2_3.1rd9djy++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20170420-01:29:44.082(2)? (STDERR) at /Users/swyx/Desktop/webdev/swyx-boilerpl8/.meteor/local/build/programs/server/boot.js:128:5
W20170420-01:29:44.082(2)? (STDERR) at /Users/swyx/Desktop/webdev/swyx-boilerpl8/.meteor/local/build/programs/server/boot.js:344:5
W20170420-01:29:44.083(2)? (STDERR) at Function.run (/Users/swyx/Desktop/webdev/swyx-boilerpl8/.meteor/local/build/programs/server/profile.js:480:12)
W20170420-01:29:44.083(2)? (STDERR) at /Users/swyx/Desktop/webdev/swyx-boilerpl8/.meteor/local/build/programs/server/boot.js:343:11
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.
安装meteor npm install --save meteor-node-stubs
不会做任何事情。
请帮帮忙?
要复制的步骤:
imports/api/documents/server/methods.js
,添加const getPackage = require('get-repo-package-json')