[SOLVED] Can't run tests after updating NPM packages due to "static {" parse error in "packages/modules.js"

I can run my server and app just fine but tests won’t start up.

I’m running this command:

SERVER_NODE_OPTIONS='--trace-uncaught --trace-warnings' TEST_WATCH=1 meteor test --port 3006 --driver-package meteortesting:mocha --full-app --inspect --settings test.json

Output:

=> Started MongoDB.
W20240126-19:27:50.454(7)? (STDERR) Debugger listening on ws://127.0.0.1:9229/03bc46da-58c4-4c40-a84c-934ed8e96fad
W20240126-19:27:50.465(7)? (STDERR) For help, see: https://nodejs.org/en/docs/inspector
W20240126-19:27:50.717(7)? (STDERR) packages/modules.js:67683
W20240126-19:27:50.717(7)? (STDERR)   static {
W20240126-19:27:50.717(7)? (STDERR)          ^
W20240126-19:27:50.717(7)? (STDERR) 
W20240126-19:27:50.718(7)? (STDERR) SyntaxError: Unexpected token '{'
W20240126-19:27:50.718(7)? (STDERR)     at new Script (vm.js:102:7)
W20240126-19:27:50.718(7)? (STDERR)     at createScript (vm.js:262:10)
W20240126-19:27:50.718(7)? (STDERR)     at Object.runInThisContext (vm.js:310:10)
W20240126-19:27:50.718(7)? (STDERR)     at /tmp/meteor-test-run1n34sl7.i4l7i/.meteor/local/build/programs/server/boot.js:370:32
W20240126-19:27:50.719(7)? (STDERR)     at Array.forEach (<anonymous>)
W20240126-19:27:50.719(7)? (STDERR)     at /tmp/meteor-test-run1n34sl7.i4l7i/.meteor/local/build/programs/server/boot.js:210:21
W20240126-19:27:50.719(7)? (STDERR)     at /tmp/meteor-test-run1n34sl7.i4l7i/.meteor/local/build/programs/server/boot.js:439:7
W20240126-19:27:50.719(7)? (STDERR)     at Function.run (/tmp/meteor-test-run1n34sl7.i4l7i/.meteor/local/build/programs/server/profile.js:256:14)
W20240126-19:27:50.719(7)? (STDERR)     at /tmp/meteor-test-run1n34sl7.i4l7i/.meteor/local/build/programs/server/boot.js:438:13
W20240126-19:27:50.720(7)? (STDERR) Thrown at:
W20240126-19:27:50.720(7)? (STDERR)     at Script (vm.js:102:7)
W20240126-19:27:50.720(7)? (STDERR)     at createScript (vm.js:262:10)
W20240126-19:27:50.720(7)? (STDERR)     at runInThisContext (vm.js:310:10)
W20240126-19:27:50.720(7)? (STDERR)     at /tmp/meteor-test-run1n34sl7.i4l7i/.meteor/local/build/programs/server/boot.js:370:32
W20240126-19:27:50.721(7)? (STDERR)     at /tmp/meteor-test-run1n34sl7.i4l7i/.meteor/local/build/programs/server/boot.js:210:21
W20240126-19:27:50.721(7)? (STDERR)     at /tmp/meteor-test-run1n34sl7.i4l7i/.meteor/local/build/programs/server/boot.js:439:7
W20240126-19:27:50.721(7)? (STDERR)     at run (/tmp/meteor-test-run1n34sl7.i4l7i/.meteor/local/build/programs/server/profile.js:256:14)
W20240126-19:27:50.721(7)? (STDERR)     at /tmp/meteor-test-run1n34sl7.i4l7i/.meteor/local/build/programs/server/boot.js:438:13
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.

Any ideas how I can get more info on what package is causing the issue? Seems like meteor may be using an older version of node or something.

I’m running Meteor 2.14.

package.json:

{
	"name": "---",
	"scripts": {},
	"dependencies": {
		"@babel/runtime": "^7.23.9",
		"@dimforge/rapier3d": "^0.11.2",
		"@easypost/api": "^7.2.0",
		"@paypal/checkout-server-sdk": "^1.0.3",
		"@vimeo/player": "^2.21.0",
		"adaptive-bezier-curve": "^1.0.3",
		"async": "^3.2.5",
		"aws-cloudfront-sign": "^3.0.2",
		"aws-sdk": "^2.1544.0",
		"babel-polyfill": "^6.26.0",
		"babel-runtime": "^6.26.0",
		"batchelor": "^2.0.2",
		"bcrypt": "^5.1.1",
		"blueimp-load-image": "^5.16.0",
		"bullmq": "^5.1.5",
		"chart.js": "^4.4.1",
		"cleaner": "git+https://github.com/seba/xolvio-cleaner.git#master",
		"clone-deep": "^4.0.1",
		"connect-route": "^0.1.5",
		"cookieconsent": "^3.1.1",
		"core-js": "^3.35.1",
		"crypto-js": "^4.2.0",
		"date-diff": "^1.0.2",
		"deep-object-diff": "^1.1.9",
		"detector-webgl": "^2.0.0",
		"digest-fetch": "^3.1.1",
		"force-graph": "^1.43.4",
		"form-data": "^4.0.0",
		"format-email": "^0.1.0",
		"google-spreadsheet": "^4.1.1",
		"googleapis": "^131.0.0",
		"hls.js": "^1.5.2",
		"hmmac": "^0.2.2",
		"http-headers-validation": "^0.0.1",
		"http-proxy": "^1.18.1",
		"i18n-iso-countries": "^7.8.0",
		"ibantools": "^4.3.9",
		"iplocation": "^7.2.0",
		"jquery": "3.7.1",
		"js-base64": "^3.7.6",
		"lodash": "^4.17.21",
		"md5": "^2.3.0",
		"memoizee": "^0.4.15",
		"meteor-node-stubs": "^1.2.7",
		"mime-types": "^2.1.35",
		"mimemessage": "^1.0.5",
		"mongodb": "^6.3.0",
		"music-metadata-browser": "^2.5.10",
		"object-sizeof": "^2.6.4",
		"postprocessing": "^6.34.1",
		"qrcode-reader": "^1.0.4",
		"random-seed": "^0.3.0",
		"rectangle-overlap": "^2.0.0",
		"request-promise-native": "^1.0.7",
		"rete": "^2.0.2",
		"rete-area-plugin": "^2.0.1",
		"rete-comment-plugin": "^2.0.0",
		"rete-connection-mastery-plugin": "^0.2.4",
		"rete-connection-plugin": "^2.0.0",
		"rete-history-plugin": "^2.0.0",
		"rete-task-plugin": "^0.3.0",
		"shippo": "^1.7.1",
		"simpl-schema": "^1.13.1",
		"sprintf": "^0.1.5",
		"stats.js": "^0.17.0",
		"stripe": "^6.30.30",
		"three": "^0.160.1",
		"three-custom-shader-material": "^5.4.0",
		"three-line-2d": "^1.1.6",
		"three-noise": "^1.1.2",
		"toposort": "^2.0.2",
		"useragent": "^2.3.0",
		"yamlparser": "0.0.2"
	},
	"devDependencies": {
		"@faker-js/faker": "^8.4.0",
		"chai": "^5.0.3",
		"chai-as-promised": "^7.1.1",
		"command-line-args": "^5.2.1",
		"command-line-usage": "^7.0.1",
		"git-cz": "^4.9.0",
		"replace-ext": "^2.0.0"
	}
}

Any thoughts?

Thanks for any help. :slight_smile:

Indeed Meteor is using an older node version. Best practice is to do meteor npm install, which can help ensure compatibility, but you can still run afoul of package versions that will break your build. Have a look at the packages that changed, and backtrack until you find the culprit.
Spoiler alert, this can take some time, and should include a rm -rf node_modules package-lock.json every time to make sure it’s a clean build

Hi, thanks for the response.

Yep, I’m always using meteor npm ... for everything.

I use meteor npm shrinkwrap as my understanding is it’s recommended over usage of package-lock.json

The issue is the use of static { here:

67680 // node_modules/assertion-error/index.js
67681 var canElideFrames = "captureStackTrace" in Error;
67682 var AssertionError = class _AssertionError extends Error {
67683   static {                       // <------------ :(
67684     __name(this, "AssertionError");
67685   }
67686   message;
67687   get name() {
67688     return "AssertionError";
67689   }
67690   get ok() {
67691     return false;
67692   }

assertion-error is a dependency of chai – from npm-shrinkwrap.json:

 553     "chai": {
 554       "version": "5.0.3",
 555       "resolved": "https://registry.npmjs.org/chai/-/chai-5.0.3.tgz",
 556       "integrity": "sha512-wKGCtYv2kVY5WEjKqQ3fSIZWtTFveZCtzinhTZbx3/trVkxefiwovhpU9kRVCwxvKKCEjTWXPdM1/T7zPoDgow==",
 557       "dev": true,
 558       "requires": {
 559         "assertion-error": "^2.0.1",
 560         "check-error": "^2.0.0",
 561         "deep-eql": "^5.0.1",
 562         "loupe": "^3.1.0",
 563         "pathval": "^2.0.0"
 564       },

I dropped chai back to “^4.3.6” for now and things are working again. :slight_smile: