node.jsgulpgulp-rename

Gulp Rename illegal operation


My gulp file looks like:

function aureliaJsonPath(name) {
    return `./aurelia_project/aurelia.${name}.json`;
}

gulp.task('use-login-au-json', () => {
    return gulp.src(aureliaJsonPath('login'))
        .pipe(rename('aurelia.json'))
        .pipe(gulp.dest('./aurelia_project'));
});

[11:59:18] Error: EISDIR: illegal operation on a directory, open '... base directory...\aurelia_project\aurelia.json'

Basically, I have a directory with aurelia.login.json which I want to copy and rename to aurelia.json in the same directory.


Solution

  • The problem here was because in previous tests I had accidentally created a directory called aurelia.json inside the directory I was trying to create the file aurelia.json

    After deleting that directory it then worked perfectly.