The instructions from documentation as-is doesn’t work because shrinkpack requires NPM 7, we have tried working around the issue by using npm commands outside the meteor scope and so far seems to work fine in my local MacOS setup.
npm install
npm shrinkwrap
shrinkpack
npm ci --offline
Our meteor app runs fine locally, but once we commit the changes (including the node_shrinkpack directory and npm-shrinkwrap.json), pushed to our CI (Gitlab Runner running Ubuntu 20), we’re getting build errors like this:
Build failed:
While building for web.browser.legacy:
imports/startup/client/index.jsx:
/app/imports/startup/client/index.jsx:
Cannot read property 'uid' of undefined
We do not have anything referencing “uid” in the said jsx file.
Interested if anyone is successful with this and if there are guidelines we’ve missed.
Hi @hschmaiske , i am using the same npm/node version in my local MacOS and the Ubuntu EC2 (where our pipeline and build runs) .
npm v8.0.0
node v16.11.11
The build runs fine on my local MacOS, but it fails on the Ubuntu EC2.
However, i’d like to note that Meteor is using an older bundled version as follows:
npm v6.14.15
node v14.18.3
Unfortunately, Shrinkpack does not work with the npm bundled with Meteor because Shrinkpack requires at least NPM v7, so we have to execute npm outside of Meteor.
Meteor works with Node.js version >= 10 and <= 14, for Windows you need to have Node.js installed for running the npm installer (tip: you can use nvm for managing node versions). https://docs.meteor.com/install.html#prereqs
Right now, Meteor does not support node 16, that’s probably why you are facing this problem. You can try using an old version of npm Shrinkwrap that is supported with node 14.
We have a plan to enable Meteor to update to the latest versions of Node, but right now, we are working on this
You can check the plan here:
Got this @hschmaiske , just as we’ve thought. as of now we are reluctant to use the previous Shrinkwrap version that supports node 14 because it is a 6 year old release.
We will wait for Meteor to support node16. Thank you for clarifying this