Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp files causing ENOENT errors #36

Open
deepfriedmind opened this issue Jun 17, 2015 · 8 comments
Open

Temp files causing ENOENT errors #36

deepfriedmind opened this issue Jun 17, 2015 · 8 comments

Comments

@deepfriedmind
Copy link

While my watch task is active and the scss-lint task is run, I sporadically get errors like the following:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: ENOENT, open '/path/to/some/filename_scsslint_tmp4101218392592792874.scss'
    at Error (native)

I suspect it's because I'm also running the scss-lint plugin for PhpStorm (so I can catch issues even before saving), and that it creates these temp files.

I've excluded them from the src in the Gulp task, using gulp-ignore, like so:

gulp.task('scss-lint', function() {

    return gulp.src('src/styles/**/*.scss')
        .pipe($.ignore.exclude('**/*_scsslint_tmp*.scss'))
        .pipe($.scssLint())
});

...and have confirmed with gulp-debug that the temp files aren't piped to scss-lint – yet I still get these errors from time to time. I haven't found a way to consistently reproduce the error unfortunately. Any ideas?

@juanfran
Copy link
Owner

that's very weird... try to add the verbose options and see what prints..

have you tried this?

gulp.task('scss-lint', function() {
    return gulp.src(['src/styles/**/*.scss', '!**/*_scsslint_tmp*.scss'])
        .pipe($.scssLint())
});

@SpenceDiNicolantonio
Copy link

I've been experiencing a similar issue...

I use a similar glob to reference my source in the following task:

gulp.task('styles', ['lint:sass'], function() {
    return gulp.src(config.styles.src)
        .pipe(...
}

and have the same glob registered for a watch to trigger my styles task:

gulp.watch(config.styles.src, ['styles']);

This should work such that whenever I change a file, the lint:sass task is run, followed by the styles task; however, whenever I change a file, I see the following output:

[13:21:41] Starting 'lint:sass'...
[13:21:41] gulp-debug: app/modules/header/header-component_scsslint_tmp9067563165859372843.scss
[13:21:41] gulp-debug: 1 items
[13:21:41] gulp-notify: [Compile Error] Input file did not exist or was not readable
[13:21:41] Finished 'lint:sass' after 246 ms
[13:21:41] Starting 'styles'...
[13:21:41] Starting 'lint:sass'...
[13:21:41] gulp-debug: app/modules/header/header-component.scss
[13:21:41] gulp-debug: 1 items
[13:21:42] Finished 'lint:sass' after 1.08 s
[BS] Reloading Browsers...
[13:21:43] Finished 'styles' after 2.29 s

As you can see, there is an additional execution of the lint:sass task somehow, with header-component_scsslint_tmp9067563165859372843.scss included in the stream.

@SpenceDiNicolantonio
Copy link

I've managed to work around the issue by extending gulp.watch to add an exclusion to the passed glob:

var EXCLUDE_GLOB = '!!(node_modules)/**/*_scsslint_tmp*';    // !(node_modules) for performance

var gulp_watch = gulp.watch;
    gulp.watch = function() {
        var src = arguments[0];

        src = _.isString(src) ? [src] : src;
        if (!_.contains(src, EXCLUDE_GLOB)) {
            src.push(EXCLUDE_GLOB);
        }

        arguments[0] = src;
        return gulp_watch.apply(gulp, arguments);
    };

The result is the following, as expected:

[13:45:36] Starting 'lint:sass'...
[13:45:36] gulp-debug: app/modules/header/header-component.scss
[13:45:36] gulp-debug: 1 items
[13:45:37] Finished 'lint:sass' after 406 ms
[13:45:37] Starting 'styles'...
[BS] Reloading Browsers...
[13:45:39] Finished 'styles' after 2.51 s

@juanfran
Copy link
Owner

thanks @SpenceDiNicolantonio !

@SpenceDiNicolantonio
Copy link

@juanfran, I assume these temp files are generated by scss-lint itself and not by gulp-scss-lint. Can you confirm? If this is the case, I'll submit a bug to the scss-lint project. I think these files should be generated in the system's temp folder.

@juanfran
Copy link
Owner

that's it, gulp-scss-lint doesn't create any tmp file

@AndyOGo
Copy link

AndyOGo commented Sep 16, 2016

I think it could be an IDE problem, I use PHPStorm (newest version) and get these weird tmp files for my js files.
Yes .jsnot .scss...

It's horrible it creates those tmp files inside source dir, and scsslint for js files does not make any sense...

tasks/docs-scripts_scsslint_tmp1537225672253761620.js
tasks/scripts-bundle_scsslint_tmp4377624646903046346.js

@AndyOGo
Copy link

AndyOGo commented Sep 16, 2016

I created an issue at the scss-lint inteliJ plugin
idok/scss-lint-plugin#45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants