Wednesday, 19 April 2017

Meteor dies horribly when I simply try to require a node module

I am working off of https://github.com/sw-yx/base-fcc as a basic boilerplate and trying to add in new functionality from a node package in my imports/api/documents/server/methods.js.

just adding this one line: const getPackage = require('get-repo-package-json')

causes a catastrophic failure with this very unhelpful message:

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.

installing meteor npm install --save meteor-node-stubs does nothing.

Please help?



via swyx

No comments:

Post a Comment