Workaround for Meteor packages.json error when upgrading from 1.2 to 1.3 and deploying in a docker container

So this is the problem I found the answer to, instead of asking a question, so hopefully this is resolved. I have a meteor application that has been upgraded from 1.2 to 1.3 and deployed to a docker container. I was getting this error:

 /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{59:18 at [object O  bject] .withValue (/tools/utils/fiber-helpers.js:89:14) at /tools/utils/buildmessage.jsrouble52:34 at [object Object] .withValue (/ tools / utils / fiber-helpers. js: 89: 14) at /tools/utils/buildmessage.js{50: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.jshaps59:18 at [object Object ] .withValue (/tools/utils/fiber-helpers.js:89:14) at /tools/utils/buildmessage.js{52:34:34 [object Object] .withValue (/tools/utils/fiber-helpers.js : 89: 14) at /tools/utils/buildmessage.js{50: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) a  t /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.jshaps59: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.jshaps50: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{59:18 at  [object Object] .withValue (/tools/utils/fiber-helpers.js:89:14) at /tools/utils/buildmessage.jsrouble52:34 at [object Object] .withValue (/ tools / utils / fiber- helpers.js: 89: 14) at /tools/utils/buildmessage.jshaps50: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.jshaps57: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 (/ to  ols / utils / fiber-helpers.js: 89: 14) at Object.capture (/tools/utils/buildmessage.js:252:19) at bundleApp (/tools/runners/run-app.js∗56: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 

My first thought was that it was a docker caching issue ( http://thenewstack.io/understanding-the-docker-cache-for-faster-builds/ ), without knocking down the latest meteor from install.meteor.com, and therefore some kind of weird version mismatch. I decided that changing the line in the Docker file would be:

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

Surprisingly, I fixed this problem and now I had the current version of the meteorite, but I was still getting the error. At the moment, I just need my deployment to work, because we are in the middle of the sprint, and here we come to one of my most hacky decisions:

I added a symlink inside the dir package called packages.json, which pointed to package.json in the main directory of my project.

If someone wants to comment on what is the root cause of the problem, and the actual solution, which would be awesome, but hopefully this helps someone who needs a workaround.

+6
source share
1 answer

First get rid of the corrupt packages:

meteor remove npm-container meteor remove meteorhacks:npm

Then you need to fix any old NpmRequire code to do it in a new way. In Meteor 1.3, you can now use npm, like any node.js application.

meteor npm init to create package.json

meteor npm install --save underscore to add dependency in your application

Now you can import it into your application via:

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

See http://guide.meteor.com/using-packages.html for a full explanation.

0
source

All Articles