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

标签 meteor docker

因此,这是一个问题,我找到了答案,而不是提出问题,因此希望可以。我有一个从1.2升级到1.3并部署到Docker容器中的 meteor 应用程序。我收到此错误:

/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
抛出错误;
^
错误:没有数据,文件路径或符号链接(symbolic link)路径时,Builder无法写入:os/packages/packages.json
在Builder.write(/tools/isobuild/builder.js:251:13)
在Builder.writeToGeneratedFilename(/tools/isobuild/builder.js:382:10)
在/tools/isobuild/isopack.js:1400:27
在Array.forEach( native )
在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)
在_.each.builder.copyDirectory.from(/tools/isobuild/isopack.js:1372:11)
在Array.forEach( native )
在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)
在/tools/isobuild/isopack.js:1263:9
在Isopack ._。extend.saveToPath(/tools/isobuild/isopack.js:1641:7)
在/tools/isobuild/isopack-cache.js:323:23
在/tools/utils/buildmessage.js:359:18
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:352:34
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:350:23
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在Object.enterJob(/tools/utils/buildmessage.js:324:26)
在[object Object] ._ loadLocalPackage(/tools/isobuild/isopack-cache.js:260:18)
在/tools/isobuild/isopack-cache.js:194:16
在Function.time(/tools/tool-env/profile.js:305:10)
在/tools/isobuild/isopack-cache.js:193:17
在/tools/utils/buildmessage.js:359:18
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:352:34
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:350:23
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在Object.enterJob(/tools/utils/buildmessage.js:324:26)
在[object Object] ._ ensurePackageLoaded(/tools/isobuild/isopack-cache.js:184:20)
在/tools/isobuild/isopack-cache.js:75:14
在/tools/packaging/package-map.js:57:7
在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)
在[object Object] .eachPackage(/tools/packaging/package-map.js:49:7)
在[object Object] .buildLocalPackages(/tools/isobuild/isopack-cache.js:74:24)
在/tools/project-context.js:758:25
在/tools/utils/buildmessage.js:359:18
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:352:34
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:350:23
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在Object.enterJob(/tools/utils/buildmessage.js:324:26)
在ProjectContext ._。extend._buildLocalPackages(/tools/project-context.js:757:18)
在/tools/project-context.js:278:9
在/tools/utils/buildmessage.js:359:18
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:352:34
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:350:23
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在Object.enterJob(/tools/utils/buildmessage.js:324:26)
在ProjectContext._completeStagesThrough(/tools/project-context.js:268:18)
在/tools/project-context.js:260:12
在Function.run(/tools/tool-env/profile.js:489:12)
在ProjectContext.prepareProjectForBuild(/tools/project-context.js:259:13)
在/tools/runners/run-app.js:557:29
在/tools/utils/buildmessage.js:271:13
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:264:29
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:262:18
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在/tools/utils/buildmessage.js:253:23
在[object Object] .withValue(/tools/utils/fiber-helpers.js:89:14)
在Object.capture(/tools/utils/buildmessage.js:252:19)
在bundleApp(/tools/runners/run-app.js:556:31)
在AppRunner._runOnce(/tools/runners/run-app.js:634:35)
在AppRunner._fiber(/tools/runners/run-app.js:887:28)
在/tools/runners/run-app.js:411:12

我首先想到的是docker(http://thenewstack.io/understanding-the-docker-cache-for-faster-builds/)没有从install.meteor.com提取最新的 meteor 版本的缓存问题,因此出现了一些奇怪的版本不匹配的情况。我通过将Dockerfile中的行更改为:
RUN curl https://install.meteor.com/ | sh; echo "version 1.3"
太好了,解决了这个问题,现在我有了当前的 meteor 版本,但是仍然出现错误。在这一点上,我只需要部署就可以了,因为我们处于冲刺之中,在这里,我们找到了迄今为​​止我最骇人听闻的解决方案之一:

我在名为packages.json的软件包目录中添加了一个符号链接(symbolic link),该链接指向我的项目主目录中的packages.json。

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

最佳答案

首先摆脱有问题的软件包:
meteor remove npm-containermeteor 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

关于从1.2升级到1.3并在Docker容器中部署时,Meteorpackages.json错误解决方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36362116/

相关文章:

reactjs - 如何将 validate-state 与 React-bootstrap 一起使用

docker - Docker 容器中的 DNS 服务器

node.js - 无法使用 Node :alpine 在 Docker 容器中运行 React 应用程序的开发版本

performance - meteor :帐户登录链接需要时间来加载

meteor - Momentjs 在 meteor react ?

javascript - Iron Router 未在产量中渲染模板

javascript - 通过收集迭代时的 meteor 延迟

docker - Busybox Docker镜像依赖链

docker - Hyperledger Fabric 对等容器无法与 couchdb 容器通信

ubuntu - Docker 是在 WSL 中运行还是连接回 Windows?