Topic: Gulp customization changes file permissions

duckies free asked 3 years ago


I have checked in my MDB-Gulp_4.19.0 directory into our source control system, Perforce. Upon checking out all files under .../MDB-Gulp_4.19.0/dist folder, when I run 'gulp mdb-pro', it started up fine; however, as soon as I made a change to _custom-skin.scss file, I got errors for some of the .css files under 'dist/css' and 'dist/css/modules'.

For example: [Browsersync] Serving files from: ./dist [14:55:46] Starting 'css-compile'... [14:55:46] Starting 'css-compile-modules'... [14:55:46] Finished 'css-compile-modules' after 24 ms [14:55:46] Starting ''... Browserslist: caniuse-lite is outdated. Please run next command npm update [14:55:47] The following tasks did not complete: , css-compile, [14:55:47] Did you forget to signal async completion? events.js:292 throw er; // Unhandled 'error' event ^

Error: EPERM: operation not permitted, open '...\MDB-Gulp-Pro_4.19.1\dist\css\modules\animations-ext ended.css' Emitted 'error' event on Domain instance at: at Pumpify.EventEmitter.emit (domain.js:500:12) at errorOrDestroy (internal/streams/destroy.js:108:12) at Pumpify.onerror (_stream_readable.js:753:7) at Pumpify.emit (events.js:315:20) at Pumpify.EventEmitter.emit (domain.js:482:12) at Pumpify.Duplexify._destroy (...\MDBGulpPro_4.19.1\node_modules\duplexify\index.js:191:15) at ..\MDB-Gulp-Pro_4.19.1\node_modules\duplexify\index.js:182:10 at processTicksAndRejections (internal/process/task_queues.js:79:11) { errno: -4048, code: 'EPERM', syscall: 'open', path: '...\MDB-Gulp-Pro_4.19.1\dist\css\modules\animations-extended.css', domainEmitter: Pumpify { _readableState: ReadableState { objectMode: true, highWaterMark: 16, buffer: BufferList { length: 0 }, length: 0, pipes: [WriteStream], pipesCount: 1, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, resumeScheduled: false, destroyed: true, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, ...

Running 'npm update' did nothing to get rid of the error. After hours of debugging and investigation, it turned out that prior to running 'gulp mdb-go', the files checked out from Perforce had the usual '-rwxrwx---+ 1 Domain Users 810866 Jan 28 15:24 animations-extended.css' file permission. After changing _custom-skins.scss and getting the above error, the file permission was changed to: '-r-xr-x---+ 1 Domain Users 75348 Jan 28 21:30 animations-extended.css' for all .css files checked out under 'dist/css'. We have used Perforce for many years w/o any problem so I suspect Gulp is doing this. How can we get Gulp to stop changing file permission from read-write to read? It is impossible to compile _custom-*.scss files and auto-generate .css files when the files are checked into the source controls system. If the files are not under source control, Gulp will not produce errors and file permissions are unchanged(all remain read-write). Any suggestion is much appreciated.

Krzysztof Wilk staff answered 3 years ago


Yes, that is a bug with a gulp. It shouldn't touch permissions, but somehow it does.

I think changing the catalog owner could be helpful. I assume that you are a Linux user. You can use sudo chown -R <username> <file> command.

If that's impossible for some security cases - you can consider using one of the packages below:

Best regards

duckies free commented 3 years ago

Hi Krzysztof!

I appreciate your response. Good to know that it is a known issue with Gulp. I am not sure setting the file owner with 'gulp-chown' or 'gulp-chmod' wil help since I see that for both local source code controlled files and those same files not under source control, they have the same owner, me, and group names are the same.

For now to get around this, I will make a copy of those dis/css/ files to a non source control directory and do my work. Then I'll diff and copy back to a local source control directory to check them in. A bit of a pain and wish there is a bit workaround.


Krzysztof Wilk staff commented 3 years ago


If you have more questions - feel free to ask :)

Best regards

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.19.1
  • Device: All
  • Browser: IE 11, Firefox, Chrome
  • OS: Windows
  • Provided sample code: Yes
  • Provided link: No