Node gyp ERR – invalid mode: ‘rU’ while trying to load binding.gyp
I was facing this same error. I had python v3.11 and canvas v2.7.0 in my package.json. Solution: All I did was downgrade my python version to v3.10 and the error disappeared. You can install it from here