_fs.unlinkSync produces "EPERM, operation not permitted" error. #17

thegreenpizza opened this Issue Jan 2, 2013 · 4 comments


None yet

2 participants


It seems the _fs.unlinkSync event at line 90 of node-minify.js can throw an EPERM, operation not permitted error. This happens when the no-compress function is used quickly back to back (as in to concatenate a series of folders of files and then combine them after).

This is occurring on Windows 7 64 bit using the latest version of node.

srod commented Jan 4, 2013


Thank you for your report, I will check that.


Update: it seems like this bug shows up with using the .minify function back to back (as in while looping through an array of directories, each with lots of files to combine).

What seems to be happening is that the minify program is stepping on its own feet when called in this manner. Here is an example of the code:

var paths = {///array of paths}}
var out = {{//array of outfiles}}

for(key in paths) {
    inPath = paths[key];
    outPath = out[key];
    files = fs.readdirSync(inPath)
    files = files.sort();
    if(files.length > 0) {

        for(i = 0; i < files.length; i++)
        files[i] = inPath + "/" + files[i];

    new compressor.minify({
    type: compressionType,
    buffer : 1000 * 2056,
    fileIn: files,
    fileOut: outPath,
    callback: function(err){
            console.log("Error using in-path:'" + inPath + "', out-path:'" + outPath + "'. Error: " + err);

srod commented Jan 16, 2013

OK, I try with a small example and it's working.

var http = require('http'),
    compressor = require('node-minify');

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
}).listen(1337, "");

new compressor.minify({
    type: 'no-compress',
    fileIn: ['test/base.js', 'test/base2.js'],
    fileOut: 'test/base-onefile.js',
    callback: function(err){

console.log('Server running at');

Can you give me a sample of code ?

srod commented Mar 24, 2013

Closing it, reopen if it still occur, thanks.

@srod srod closed this Mar 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment