从1.2升级到1.3并在docker容器中部署时,Meteor packages.json错误解决方法

时间:2016-04-01 17:13:00

标签: meteor docker

所以这是一个问题,我找到了答案,而不是问一个问题,所以希望这是允许的。我有一个从1.2升级到1.3的流星应用程序并部署到一个docker容器中。我收到了这个错误:

/root/.meteor/packages/templating/.1.1.7.kbxyh0++os+web.browser+web.cordova/plugin.compileTemplatesBatch.os/npm/node_modules/meteor/promise/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:116
      throw error;
            ^
Error: Builder can not write without either data or a file path or a symlink path: os/packages/packages.json
    at Builder.write (/tools/isobuild/builder.js:251:13)
    at Builder.writeToGeneratedFilename (/tools/isobuild/builder.js:382:10)
    at /tools/isobuild/isopack.js:1400:27
    at Array.forEach (native)
    at Function._.each._.forEach (/root/.meteor/packages/meteor-tool/.1.3.0_3.fc5itk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
    at _.each.builder.copyDirectory.from (/tools/isobuild/isopack.js:1372:11)
    at Array.forEach (native)
    at Function._.each._.forEach (/root/.meteor/packages/meteor-tool/.1.3.0_3.fc5itk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
    at /tools/isobuild/isopack.js:1263:9
    at Isopack._.extend.saveToPath (/tools/isobuild/isopack.js:1641:7)
    at /tools/isobuild/isopack-cache.js:323:23
    at /tools/utils/buildmessage.js:359:18
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:352:34
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:350:23
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.enterJob (/tools/utils/buildmessage.js:324:26)
    at [object Object]._loadLocalPackage (/tools/isobuild/isopack-cache.js:260:18)
    at /tools/isobuild/isopack-cache.js:194:16
    at Function.time (/tools/tool-env/profile.js:305:10)
    at /tools/isobuild/isopack-cache.js:193:17
    at /tools/utils/buildmessage.js:359:18
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:352:34
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:350:23
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.enterJob (/tools/utils/buildmessage.js:324:26)
    at [object Object]._ensurePackageLoaded (/tools/isobuild/isopack-cache.js:184:20)
    at /tools/isobuild/isopack-cache.js:75:14
    at /tools/packaging/package-map.js:57:7
    at Function._.each._.forEach (/root/.meteor/packages/meteor-tool/.1.3.0_3.fc5itk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:87:22)
    at [object Object].eachPackage (/tools/packaging/package-map.js:49:7)
    at [object Object].buildLocalPackages (/tools/isobuild/isopack-cache.js:74:24)
    at /tools/project-context.js:758:25
    at /tools/utils/buildmessage.js:359:18
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:352:34
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:350:23
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.enterJob (/tools/utils/buildmessage.js:324:26)
    at ProjectContext._.extend._buildLocalPackages (/tools/project-context.js:757:18)
    at /tools/project-context.js:278:9
    at /tools/utils/buildmessage.js:359:18
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:352:34
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:350:23
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.enterJob (/tools/utils/buildmessage.js:324:26)
    at ProjectContext._completeStagesThrough (/tools/project-context.js:268:18)
    at /tools/project-context.js:260:12
    at Function.run (/tools/tool-env/profile.js:489:12)
    at ProjectContext.prepareProjectForBuild (/tools/project-context.js:259:13)
    at /tools/runners/run-app.js:557:29
    at /tools/utils/buildmessage.js:271:13
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:264:29
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:262:18
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:253:23
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.capture (/tools/utils/buildmessage.js:252:19)
    at bundleApp (/tools/runners/run-app.js:556:31)
    at AppRunner._runOnce (/tools/runners/run-app.js:634:35)
    at AppRunner._fiber (/tools/runners/run-app.js:887:28)
    at /tools/runners/run-app.js:411:12

我的第一个想法是,这是一个缓存问题,Docker(http://thenewstack.io/understanding-the-docker-cache-for-faster-builds/)没有从install.meteor.com中删除最新的流星版本,因此一些奇怪的版本不匹配。我通过将Dockerfile中的行更改为:

来解决这个问题

RUN curl https://install.meteor.com/ | sh; echo "version 1.3"

太棒了,解决了这个问题,现在我有了当前的流星版本,但我还是得到了错误。在这一点上,我只是需要我的部署工作,因为我们正处于冲刺的中间,在这里我们得到了迄今为​​止我最讨厌的解决方案之一:

我在名为packages.json的包dir中添加了一个符号链接,指向我项目主目录中的packages.json。

如果有人想评论问题的根本原因是什么,以及一个非常棒的实际解决方案,但希望这可以帮助需要解决方法的其他人。

1 个答案:

答案 0 :(得分:0)

首先摆脱有问题的包裹:

meteor remove npm-container meteor remove meteorhacks:npm

然后你需要修复任何旧的NpmRequire代码以新的方式完成它。在Meteor 1.3中,您现在可以像任何node.js应用程序一样使用npm。

meteor npm init创建package.json

meteor npm install --save underscore在您的应用中添加相关性

现在您可以通过以下方式将其导入您的应用:

import _ from 'underscore'var _ = require('underscore')

有关完整说明,请参阅http://guide.meteor.com/using-packages.html