Unable to run after update to 2.5.2

Hi, i just updated my project from version 1.8 to 2.5.2 and now when i try to run it i see this error :

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/fs/tools/fs/optimistic.ts:321:17
    at wrap.makeCacheKey (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/fs/tools/fs/optimistic.ts:36:15)
    at recomputeNewValue (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:198:31)
    at Slot.withValue (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/@wry/context/lib/context.esm.js:69:29)
    at reallyRecompute (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:181:19)
    at Entry.recompute (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:91:9)
    at optimistic (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/optimism/src/index.ts:150:25)
    at /Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/fs/tools/fs/optimistic.ts:366:19
    at recomputeNewValue (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:198:31)
    at Slot.withValue (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/@wry/context/lib/context.esm.js:69:29)
    at reallyRecompute (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:181:19)
    at Entry.recompute (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:91:9)
    at optimistic (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/optimism/src/index.ts:150:25)
    at find (/tools/isobuild/package-source.js:1344:30)
    at /tools/isobuild/package-source.js:1400:27
    at Array.forEach (<anonymous>)
    at find (/tools/isobuild/package-source.js:1379:22)
    at /tools/isobuild/package-source.js:1400:27
    at Array.forEach (<anonymous>)
    at find (/tools/isobuild/package-source.js:1379:22)
    at /tools/isobuild/package-source.js:1400:27
    at Array.forEach (<anonymous>)
    at find (/tools/isobuild/package-source.js:1379:22)
    at /tools/isobuild/package-source.js:1400:27
    at Array.forEach (<anonymous>)
    at find (/tools/isobuild/package-source.js:1379:22)
    at find (/tools/isobuild/package-source.js:1411:25)
    at /tools/isobuild/package-source.js:1423:34
    at Object.withCache (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/fs/tools/fs/files.ts:1662:18)
    at PackageSource._findSources (/tools/isobuild/package-source.js:1423:18)
    at SourceArch.getFiles (/tools/isobuild/package-source.js:965:32)
    at /tools/isobuild/compiler.js:406:23
    at /tools/isobuild/compiler.js:186:28
    at Object.withCache (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/fs/tools/fs/files.ts:1662:18)
    at /tools/isobuild/compiler.js:185:11
    at Function.each (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore-node-f-pre.js:1316:7)
    at Object.compile (/tools/isobuild/compiler.js:180:5)
    at /tools/isobuild/bundler.js:3295:24
    at Object.capture (/tools/utils/buildmessage.js:283:5)
    at bundle (/tools/isobuild/bundler.js:3241:31)
    at /tools/isobuild/bundler.js:3184:32
    at Slot.withValue (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/@wry/context/lib/context.esm.js:69:29)
    at Object.withCache (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/fs/tools/fs/files.ts:1662:39)
    at Object.bundle (/tools/isobuild/bundler.js:3184:16)
    at /tools/runners/run-app.js:581:24
    at Function.run (/Users/grzegorzpociejewski/.meteor/packages/meteor-tool/.2.5.2.rv2ntq.lmcrc++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/tools/tool-env/tools/tool-env/profile.ts:289:14)
    at bundleApp (/tools/runners/run-app.js:580:34)
    at AppRunner._runOnce (/tools/runners/run-app.js:627:35)
    at AppRunner._fiber (/tools/runners/run-app.js:949:28)
    at /tools/runners/run-app.js:410:12

Any idea, what could be reason ?

2 Likes

Having the same issue after upgrading from 2.5.1 to 2.5.2.
Downgrading back to 2.5.1 or re-installing meteor doesn’t help so far.

Hi everybody !

I have got the same issue with meteor 2.5.2 with Node 14.18.2 or Node 14.17.0.
It is weird because it works locally but not in my pipeline :confused:

Hope we will have a fix soon :slight_smile:

The error :

/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:218
      throw error;
      ^

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/optimistic.ts:321:17
    at wrap.makeCacheKey (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/optimistic.ts:36:15)
    at recomputeNewValue (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:198:31)
    at Slot.withValue (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/@wry/context/lib/context.esm.js:69:29)
    at reallyRecompute (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:181:19)
    at Entry.recompute (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:91:9)
    at optimistic (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/index.ts:150:25)
    at /home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/optimistic.ts:366:19
    at recomputeNewValue (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:198:31)
    at Slot.withValue (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/@wry/context/lib/context.esm.js:69:29)
    at reallyRecompute (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:181:19)
    at Entry.recompute (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/entry.ts:91:9)
    at optimistic (/home/vsts/.meteor/packages/meteor-tool/.2.5.2.tbofkq.6tw2n++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/index.ts:150:25)
    at find (/tools/isobuild/package-source.js:1344:30)
    at /tools/isobuild/package-source.js:1400:27
    at Array.forEach (<anonymous>)
    at find (/tools/isobuild/package-source.js:1379:22)
    at /tools/isobuild/package-source.js:1400:27
    at Array.forEach (<anonymous>)
    at find (/tools/isobuild/package-source.js:1379:22)
    at /tools/isobuild/package-source.js:1400:27

Hi,

Same error here just running the meteor build command with meteor 1.11

meteor build     --architecture os.linux.x86_64     --directory ~/meteor-build

Hi, it seems to be something broken in the local installation.

I believe I had this problem just one time and the solution was to uninstall Meteor (in Unix systems usually is enough to run rm -rf ~/.meteor).

Could you uninstall Meteor and then install again?

In this section we explain the proper way to uninstall Meteor: Install | Meteor API Docs

Let me know if uninstalling it solved the issue.

2 Likes

I think i finally found source problem, didnt fully understand it yet. I reinstalled meteor and and it didnt help. But I found this similiar problem [1.4.3.1] SyntaxError: Unexpected end of input checking `package.json` for portability. · Issue #8427 · meteor/meteor · GitHub. As @abernix suggested there I run

find . -name 'package.json' -exec node -e 'var result; try { result = JSON.parse(require("fs").readFileSync(require("path").resolve("{}"))) && "OK"; } catch (err) { result = "FAIL"; } console.log("{}", result);' \;

And realised that there is malformed package.json file in resolve - npm. However this malformed .json file is there intentionally for proper testing. Once i remove this package from dependency it started working so it seems that it is problem with meteor builder. I had no time for deeper investigation so far.

1 Like

I believe this PR #11832 fixes the problem now and also helps to identify and workaround similar issues in the future.

Let me know what you think.

I’m starting the release process of Meteor 2.5.3 including this fix.

1 Like

Meteor 2.5.3 is released now!

3 Likes

We are having the same error but without updating a 2.2 install of meteor. We didn’t change anything special but new builds fail. Can we solve it without updating ?

@ivo try this

find . -name 'package.json' -exec node -e 'var result; try { result = JSON.parse(require("fs").readFileSync(require("path").resolve("{}"))) && "OK"; } catch (err) { result = "FAIL"; } console.log("{}", result);' \;

Which package is affected ? Are you able to go without it? or “fix” it temporary?

You could remove the problematic file manually, as was done here.

What is preventing you from upgrading Meteor to the latest?

No, we’re finally doing the update and it seems to work, my worry/concern is more how a new version of Meteor causes problem with old versions to be built. We were on 2.2 corrected a small bug in our frontend code, and trying to rebuild 2.2 caused this error on build (while while working locally).

I guess am just missing a piece of the puzzle here :slight_smile:

The problem is not caused by Meteor at all.

This problem was caused by a malformed package.json in your NPM dependencies, probably resolve module. Meteor reads all the package.json in your app dependencies.

What we are doing in Meteor is to try to prevent this error starting from version 2.5.3. Or at least reporting which package.json is invalid and throwing exception.

Got it?

1 Like

ok sure, the timing was just weird with 2.5.3 release. thanks for the feedback.