Meteor Build: Uncaught TypeError: Cannot read properties of undefined (reading 'split')

const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v))

Hot to properly set this?

I am running

export NODE_VERSION=$(node -v)
node main.js --settings /app/settings.json

But the app refuses to render, and breaks

Uggggggggggh this build process is so fragile lol

OK has something to do with a package I’ve got installed… Ive got a bunch not sure which one. But on the front end its looking for Node version.

So if in my startup for Meteor I do:

console.log(process)

VM306864:1 {title: ‘browser’, browser: true, env: {…}, argv: Array(0), nextTick: ƒ, …}

Or you can do that in browser… process.version(s) is not defined.

I’ll try just definining it hardcoded.

Meteor.startup(function () {
    console.log("SCALAR SITES STARTUP");

    Blaze._allowJavascriptUrls();
    if (!process.versions || !process.versions.node) {
        // Mock the Node.js version for the browser to be 20.17.0
        process.versions = { ...process.versions, node: '20.17.0' };
    }
      

Will report back in an hour when this stupid thing builds.

Fixed it.

const cheerio = require(‘cheerio’); // Ensure you have Cheerio installed

YOU CANNOT DO THIS ON CLIENT.

So I had a file in /lib/webpages.js that had a library import for cheerio. I do a server thing with it.

I had just placed it top of the file.

Server boots up, works, yaaaay.

Client? NOPE SHE BREAKS. WTF for days.

So, the solution is to wrap it

if(Meteor.isServer){
    const cheerio = require('cheerio');
}