Try placing an empty .gitignore file in the directory its complaining about.
Alternatively, take the file straight from the official repo and place it there:
https://github.com/mendix/widgets-resources
Edit:
Found your solution:
https://github.com/mendix/widgets-resources/issues/285
A user said:
The file is missing from the distribution. I took the file from https://github.com/mendix/widgets-resources/blob/master/packages/tools/generator-widget/generators/app/templates/commons/.gitignore and placed it in the location mentioned in the error. I can now generate a widget.
i Have a generic Solution for everything :
A- in Start/CMD
1- npm install –g npm@8.6.0
2- npm install –g yo
3- npm install –g @mendix/generator-widget
4- npm install @mendix/pluggable-widgets-tools --legacy-peer-deps
B- in your widget Folder :
B.1 - in package.json Change the @mendix/pluggable-widgets-tools Version in the devDependencies object to :
...............},
//------------------------------------------------
"devDependencies": {
"@mendix/pluggable-widgets-tools": "^9.20.0"
},
//------------------------------------------------
"dependencies": { ....
B.2 open the Terminal (CMD) in your widget folder and run the following command
2- npm i
i Have a generic Solution for everything :
A- in Start/CMD
1- npm install –g npm@8.6.0
2- npm install –g yo
3- npm install –g @mendix/generator-widget
4- npm install @mendix/pluggable-widgets-tools --legacy-peer-deps
B- in your widget Folder :
B.1 - in package.json Change the @mendix/pluggable-widgets-tools Version in the devDependencies object to :
...............},
//------------------------------------------------
"devDependencies": {
"@mendix/pluggable-widgets-tools": "^9.20.0"
},
//------------------------------------------------
"dependencies": { ....
B.2 open the Terminal (CMD) in your widget folder and run the following command
2- npm i