How to solve "TypeError: process.getuid is not a function"
Was it by chance Monday when this happened? If so, I believe it's related to this issue:https://github.com/webpack/webpack-cli/issues/962
From what I gather Webpack CLI which Laravel Mix uses tries to print a message once every six days asking the user to consider donating, but recent versions relied on a function that isn't available in Windows. The logic was originally added as a consideration for people who were bothered by constantly seeing the message, and later tweaked to avoid file permission issues for Mac and Linux users, but the latter change caused problems for Windows users only on Mondays.
A solution proposed by the user rseeburg in that thread was simply to wrap the offending code in a try/catch. However, it looks like the donation message has been removed as of Webpack CLI 3.3.5, so updating the package should fix it. I got it working again by adding "webpack-cli": "^3.3.5"
to package.json followed by yarn install
.
You can do 3 things to fix that :
1- by change you day to any day excepted Monday Because this function if
const now = new Date();if (now.getDay() === MONDAY) { const { access, constants, statSync, utimesSync } = require("fs"); const lastPrint = statSync(openCollectivePath).atime; const lastPrintTS = new Date(lastPrint).getTime(); const timeSinceLastPrint = now.getTime() - lastPrintTS; if (timeSinceLastPrint > SIX_DAYS) { require(openCollectivePath); // On windows we need to manually update the atime access(openCollectivePath, constants.W_OK, e => { if (!e) utimesSync(openCollectivePath, now, now); }); }}
and that about donating to their package
2- remove that condition fileOwnerId === process.getuid())
, but it's Not Working for windows users so you can the last thing
3- add this "webpack-cli": "^3.3.5"
to your package.json
in dependencies and run npm
that working for me.