我正在使用mup进行部署,一切顺利,直到我添加reactrouter:react-router-ssr
流星包。我可以在本地运行它,但是在部署时出现以下错误:
-----------------------------------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'
----------------------------------------------------------------------------
bycrypt错误是预期的,因为npm版本显然与我使用的abernix/meteord:base
的docker镜像不兼容,我在本地遇到类似的问题,它运行正常并且部署也很好。当我添加react-router-ssr
包时发生错误,因此我认为我得到的fbjs/lib/invariant
错误是由于此。
我的mup.js是:
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: {},
},
},
};
感谢您提供的任何帮助。顺便说一句,如果有人知道如何强制mup连接到我的mongo-url而不是在本地构建mongo,那么知道也是很棒的,因为对于mup和mupx,setupMongo:false的位置似乎不同。谢谢!
编辑:如果我手动将fbjs添加到package.json存储库,那么该错误就会消失,但我会得到一个新错误:
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)
答案 0 :(得分:0)
我通过手动添加fbjs并reify到我的package.json文件解决了这两个问题。它不适用于npm install --save fbjs
或npm install --save reify
我必须手动将两者都添加到package.json中,然后才能正确部署。