Meteor mup error fbjs invariant

2019-07-30 23:18发布

I am using mup for deployment and everything goes great until I add the reactrouter:react-router-ssr meteor package. I can run it locally, but I get the following error when I deploy:

-----------------------------------STDERR-----------------------------------
    pproximately three times slower than the native implementation.
    In order to use the native implementation instead, run

      meteor npm install --save bcrypt

    in the root directory of your application.
    /bundle/bundle/programs/server/node_modules/fibers/future.js:280
                            throw(ex);
                            ^

    Error: Cannot find module 'fbjs/lib/invariant'
        at Function.Module._resolveFilename (module.js:325:15)
        at Function.Module._load (module.js:276:25)
        at Module.require (module.js:353:17)
        at require (internal/module.js:12:17)
        at Object.<anonymous> (/bundle/bundle/programs/server/npm/node_modules/react/lib/PooledClass.js:14:17)
        at Module._compile (module.js:409:26)
        at Object.Module._extensions..js (module.js:416:10)
        at Module.load (module.js:343:32)
        at Module.Mp.load (/bundle/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/reify/node/runtime.js:16:23)
        at Function.Module._load (module.js:300:12)

    => Redeploying previous version of the app

    -----------------------------------STDOUT-----------------------------------

    To see more logs type 'mup logs --tail=50'

    ----------------------------------------------------------------------------

The bycrypt error is expected because the npm version is apparently not compatible with the docker image I am using abernix/meteord:base and I get a similar issue locally and it runs fine and deploys fine as well. The error occurs when I add that react-router-ssr package and so I think the fbjs/lib/invariant error I am getting is due to that.

My mup.js is :

module.exports = {
  servers: {
    one: {
      host: '54.69.x.x',
      username: 'ubuntu',
      pem: "/Users/me/.ssh/meteor.pem"
    }
  },

  meteor: {
    name: 'App',
    path: '/Users/me/development/meteor',
    servers: {
      one: {}
    },
    buildOptions: {
      serverOnly: true,
      debug: true
    },
    enableUploadProgressBar: true,
    env: {
      ROOT_URL: 'http://54.69.x.x',
      MONGO_URL: 'mongodb://user:pass@mlab.com:39685/production'
    },

    dockerImage: 'abernix/meteord:base',
    deployCheckWaitTime: 60
  },

  mongo: {
    oplog: true,
    port: 27017,
    servers: {
      one: {},
    },
  },
};

Thanks for any help that you can provide. As an aside, if anyone knows how to force mup to connect to my mongo-url instead of building mongo locally, that would be awesome to know too because the placement of setupMongo:false seems to be different for mup versus mupx. Thanks!!

EDIT: If I manually add fbjs to the package.json repository, that error goes away but I get a new one:

    Npm.require (/bundle/bundle/programs/server/boot.js:198:17)
    at options.fallback (packages/modules-runtime/modules-runtime.js:21:1)
    at Module.require (packages/modules-runtime/.npm/package/node_modules/install/install.js:88:1)
    at Module.Mp.import (/bundle/bundle/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime.js:70:16)
    at meteorInstall.imports.ui.components.blogs.blog.js (/bundle/bundle/programs/server/app/app.js:3878:866)
    at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
    at Module.require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
    at Module.Mp.import (/bundle/bundle/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime.js:70:16)
    at meteorInstall.imports.ui.layouts.blogs.blogsList.js (imports/ui/layouts/application/app.js:8:8)
    at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)

1条回答
forever°为你锁心
2楼-- · 2019-07-31 00:05

I solved both of these issues by manually adding fbjs and reify to my package.json file. It did not work to npm install --save fbjs or npm install --save reify I had to manually add both to the package.json and then it deployed properly.

查看更多
登录 后发表回答