Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve "TypeError: process.getuid is not a function"

I am running react.js with laravel and watching changes with yarn run watch which has worked fine until I began to come across this error with webpack any time I used yarn or npm after I made some windows 10 updates (I really don't know if that could be a reason) - I would love any help.

if (!e && fileOwnerId === process.getuid()) utimesSync(openCollectivePath, now, now)

The error:

TypeError: process.getuid is not a function at C:\project_path\node_modules\webpack-cli\bin\cli.js:352:43 at FSReqCallback.oncomplete (fs.js:153:23)
like image 275
kelvin Avatar asked Jun 17 '19 21:06

kelvin


2 Answers

I was just having this issue as well. I'm not sure what caused it, but deleting my node_modules folder and re-running "npm install" fixed it for me.

like image 167
SvEnjoyPro Avatar answered Oct 17 '22 14:10

SvEnjoyPro


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.

like image 25
Yumecosmos Avatar answered Oct 17 '22 16:10

Yumecosmos