Gulp-sass gives error after 2 or 3 saves from my editor
I can save two or three times on my editor and browsersync reloads. After 1 or 2 saves with same code gulp gives me this error
events.js:167
throw er; // Unhandled 'error' event
^
Error: assetscssmain.scss
Error: File to import not found or unreadable: 2-modules/header.
on line 10 of assets/css/main.scss
>> @import '2-modules/header';
^
at options.error (C:UserswfjcuDocumentsGitHublignode_modulesnode-sasslibindex.js:291:26)
Emitted 'error' event at:
at DestroyableTransform.onerror (C:UserswfjcuDocumentsGitHublignode_modulesvinyl-fsnode_modulesreadable-streamlib_stream_readable.js:558:12)
at DestroyableTransform.emit (events.js:182:13)
at onwriteError (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:356:10)
at onwrite (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:373:11)
at WritableState.onwrite (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:126:5)
at afterTransform (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_transform.js:81:3)
at TransformState.afterTransform (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_transform.js:58:12)
at errorM (C:UserswfjcuDocumentsGitHublignode_modulesgulp-sassindex.js:118:12)
at Object.callback (C:UserswfjcuDocumentsGitHublignode_modulesgulp-sassindex.js:127:16)
at options.error (C:UserswfjcuDocumentsGitHublignode_modulesnode-sasslibindex.js:294:32)
This is the gulpfile.js this seems to be working fine before. But when i upgraded to gulp 4 it didnt and I reverted back to gulp 3.9.1 it gives the error when saving on sublime.
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var cp = require('child_process');
var pug = require('gulp-pug');
var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
var messages = {
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
};
/**
* Build the Jekyll Site
*/
gulp.task('jekyll-build', function (done) {
browserSync.notify(messages.jekyllBuild);
return cp.spawn( jekyll , ['build'], {stdio: 'inherit'})
.on('close', done);
});
/**
* Rebuild Jekyll & do page reload
*/
gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
browserSync.reload();
});
/**
* Wait for jekyll-build, then launch the Server
*/
gulp.task('browser-sync', ['sass', 'jekyll-build'], function() {
browserSync({
server: {
baseDir: '_site'
},
notify: false
});
});
/**
* Compile files from _scss into both _site/css (for live injecting) and site (for future jekyll builds)
*/
gulp.task('sass', function () {
return gulp.src('assets/css/main.scss')
.pipe(sass({
includePaths: ['css'],
onError: browserSync.notify
}))
.pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
.pipe(gulp.dest('_site/assets/css'))
.pipe(browserSync.reload({stream:true}))
.pipe(gulp.dest('assets/css'));
});
/**
* Compile files from _pugfiles into _includes (for live injecting) and site (for future jekyll builds)
*/
gulp.task('pug', function(){
return gulp.src('_pugfiles/*.pug')
.pipe(pug())
.pipe(gulp.dest('_includes'));
});
/**
* Watch scss files for changes & recompile
* Watch html/md files/pug files, run jekyll & reload BrowserSync
*/
gulp.task('watch', function () {
gulp.watch('assets/css/**', ['sass']);
gulp.watch(['*.html', '_layouts/*.html', '_includes/*'], ['jekyll-rebuild']);
gulp.watch(['_pugfiles/*.pug'], ['pug']);
});
/**
* Default task, running just `gulp` will compile the sass,
* compile the jekyll site, launch BrowserSync & watch files.
*/
gulp.task('default', ['browser-sync', 'watch']);
node version 10.4.1
npm version 6.4.1
gulp CLI 3.9.1
gulp Local 3.9.1
node.js npm gulp saas
add a comment |
I can save two or three times on my editor and browsersync reloads. After 1 or 2 saves with same code gulp gives me this error
events.js:167
throw er; // Unhandled 'error' event
^
Error: assetscssmain.scss
Error: File to import not found or unreadable: 2-modules/header.
on line 10 of assets/css/main.scss
>> @import '2-modules/header';
^
at options.error (C:UserswfjcuDocumentsGitHublignode_modulesnode-sasslibindex.js:291:26)
Emitted 'error' event at:
at DestroyableTransform.onerror (C:UserswfjcuDocumentsGitHublignode_modulesvinyl-fsnode_modulesreadable-streamlib_stream_readable.js:558:12)
at DestroyableTransform.emit (events.js:182:13)
at onwriteError (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:356:10)
at onwrite (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:373:11)
at WritableState.onwrite (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:126:5)
at afterTransform (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_transform.js:81:3)
at TransformState.afterTransform (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_transform.js:58:12)
at errorM (C:UserswfjcuDocumentsGitHublignode_modulesgulp-sassindex.js:118:12)
at Object.callback (C:UserswfjcuDocumentsGitHublignode_modulesgulp-sassindex.js:127:16)
at options.error (C:UserswfjcuDocumentsGitHublignode_modulesnode-sasslibindex.js:294:32)
This is the gulpfile.js this seems to be working fine before. But when i upgraded to gulp 4 it didnt and I reverted back to gulp 3.9.1 it gives the error when saving on sublime.
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var cp = require('child_process');
var pug = require('gulp-pug');
var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
var messages = {
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
};
/**
* Build the Jekyll Site
*/
gulp.task('jekyll-build', function (done) {
browserSync.notify(messages.jekyllBuild);
return cp.spawn( jekyll , ['build'], {stdio: 'inherit'})
.on('close', done);
});
/**
* Rebuild Jekyll & do page reload
*/
gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
browserSync.reload();
});
/**
* Wait for jekyll-build, then launch the Server
*/
gulp.task('browser-sync', ['sass', 'jekyll-build'], function() {
browserSync({
server: {
baseDir: '_site'
},
notify: false
});
});
/**
* Compile files from _scss into both _site/css (for live injecting) and site (for future jekyll builds)
*/
gulp.task('sass', function () {
return gulp.src('assets/css/main.scss')
.pipe(sass({
includePaths: ['css'],
onError: browserSync.notify
}))
.pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
.pipe(gulp.dest('_site/assets/css'))
.pipe(browserSync.reload({stream:true}))
.pipe(gulp.dest('assets/css'));
});
/**
* Compile files from _pugfiles into _includes (for live injecting) and site (for future jekyll builds)
*/
gulp.task('pug', function(){
return gulp.src('_pugfiles/*.pug')
.pipe(pug())
.pipe(gulp.dest('_includes'));
});
/**
* Watch scss files for changes & recompile
* Watch html/md files/pug files, run jekyll & reload BrowserSync
*/
gulp.task('watch', function () {
gulp.watch('assets/css/**', ['sass']);
gulp.watch(['*.html', '_layouts/*.html', '_includes/*'], ['jekyll-rebuild']);
gulp.watch(['_pugfiles/*.pug'], ['pug']);
});
/**
* Default task, running just `gulp` will compile the sass,
* compile the jekyll site, launch BrowserSync & watch files.
*/
gulp.task('default', ['browser-sync', 'watch']);
node version 10.4.1
npm version 6.4.1
gulp CLI 3.9.1
gulp Local 3.9.1
node.js npm gulp saas
We will need to see your gulpfile.js at least.
– Mark
Jan 1 at 4:18
@Mark Updated the question, you have any idea why this is happening?
– juscuizon
Jan 1 at 5:46
add a comment |
I can save two or three times on my editor and browsersync reloads. After 1 or 2 saves with same code gulp gives me this error
events.js:167
throw er; // Unhandled 'error' event
^
Error: assetscssmain.scss
Error: File to import not found or unreadable: 2-modules/header.
on line 10 of assets/css/main.scss
>> @import '2-modules/header';
^
at options.error (C:UserswfjcuDocumentsGitHublignode_modulesnode-sasslibindex.js:291:26)
Emitted 'error' event at:
at DestroyableTransform.onerror (C:UserswfjcuDocumentsGitHublignode_modulesvinyl-fsnode_modulesreadable-streamlib_stream_readable.js:558:12)
at DestroyableTransform.emit (events.js:182:13)
at onwriteError (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:356:10)
at onwrite (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:373:11)
at WritableState.onwrite (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:126:5)
at afterTransform (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_transform.js:81:3)
at TransformState.afterTransform (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_transform.js:58:12)
at errorM (C:UserswfjcuDocumentsGitHublignode_modulesgulp-sassindex.js:118:12)
at Object.callback (C:UserswfjcuDocumentsGitHublignode_modulesgulp-sassindex.js:127:16)
at options.error (C:UserswfjcuDocumentsGitHublignode_modulesnode-sasslibindex.js:294:32)
This is the gulpfile.js this seems to be working fine before. But when i upgraded to gulp 4 it didnt and I reverted back to gulp 3.9.1 it gives the error when saving on sublime.
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var cp = require('child_process');
var pug = require('gulp-pug');
var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
var messages = {
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
};
/**
* Build the Jekyll Site
*/
gulp.task('jekyll-build', function (done) {
browserSync.notify(messages.jekyllBuild);
return cp.spawn( jekyll , ['build'], {stdio: 'inherit'})
.on('close', done);
});
/**
* Rebuild Jekyll & do page reload
*/
gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
browserSync.reload();
});
/**
* Wait for jekyll-build, then launch the Server
*/
gulp.task('browser-sync', ['sass', 'jekyll-build'], function() {
browserSync({
server: {
baseDir: '_site'
},
notify: false
});
});
/**
* Compile files from _scss into both _site/css (for live injecting) and site (for future jekyll builds)
*/
gulp.task('sass', function () {
return gulp.src('assets/css/main.scss')
.pipe(sass({
includePaths: ['css'],
onError: browserSync.notify
}))
.pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
.pipe(gulp.dest('_site/assets/css'))
.pipe(browserSync.reload({stream:true}))
.pipe(gulp.dest('assets/css'));
});
/**
* Compile files from _pugfiles into _includes (for live injecting) and site (for future jekyll builds)
*/
gulp.task('pug', function(){
return gulp.src('_pugfiles/*.pug')
.pipe(pug())
.pipe(gulp.dest('_includes'));
});
/**
* Watch scss files for changes & recompile
* Watch html/md files/pug files, run jekyll & reload BrowserSync
*/
gulp.task('watch', function () {
gulp.watch('assets/css/**', ['sass']);
gulp.watch(['*.html', '_layouts/*.html', '_includes/*'], ['jekyll-rebuild']);
gulp.watch(['_pugfiles/*.pug'], ['pug']);
});
/**
* Default task, running just `gulp` will compile the sass,
* compile the jekyll site, launch BrowserSync & watch files.
*/
gulp.task('default', ['browser-sync', 'watch']);
node version 10.4.1
npm version 6.4.1
gulp CLI 3.9.1
gulp Local 3.9.1
node.js npm gulp saas
I can save two or three times on my editor and browsersync reloads. After 1 or 2 saves with same code gulp gives me this error
events.js:167
throw er; // Unhandled 'error' event
^
Error: assetscssmain.scss
Error: File to import not found or unreadable: 2-modules/header.
on line 10 of assets/css/main.scss
>> @import '2-modules/header';
^
at options.error (C:UserswfjcuDocumentsGitHublignode_modulesnode-sasslibindex.js:291:26)
Emitted 'error' event at:
at DestroyableTransform.onerror (C:UserswfjcuDocumentsGitHublignode_modulesvinyl-fsnode_modulesreadable-streamlib_stream_readable.js:558:12)
at DestroyableTransform.emit (events.js:182:13)
at onwriteError (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:356:10)
at onwrite (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:373:11)
at WritableState.onwrite (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_writable.js:126:5)
at afterTransform (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_transform.js:81:3)
at TransformState.afterTransform (C:UserswfjcuDocumentsGitHublignode_modulesthrough2node_modulesreadable-streamlib_stream_transform.js:58:12)
at errorM (C:UserswfjcuDocumentsGitHublignode_modulesgulp-sassindex.js:118:12)
at Object.callback (C:UserswfjcuDocumentsGitHublignode_modulesgulp-sassindex.js:127:16)
at options.error (C:UserswfjcuDocumentsGitHublignode_modulesnode-sasslibindex.js:294:32)
This is the gulpfile.js this seems to be working fine before. But when i upgraded to gulp 4 it didnt and I reverted back to gulp 3.9.1 it gives the error when saving on sublime.
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var cp = require('child_process');
var pug = require('gulp-pug');
var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
var messages = {
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
};
/**
* Build the Jekyll Site
*/
gulp.task('jekyll-build', function (done) {
browserSync.notify(messages.jekyllBuild);
return cp.spawn( jekyll , ['build'], {stdio: 'inherit'})
.on('close', done);
});
/**
* Rebuild Jekyll & do page reload
*/
gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
browserSync.reload();
});
/**
* Wait for jekyll-build, then launch the Server
*/
gulp.task('browser-sync', ['sass', 'jekyll-build'], function() {
browserSync({
server: {
baseDir: '_site'
},
notify: false
});
});
/**
* Compile files from _scss into both _site/css (for live injecting) and site (for future jekyll builds)
*/
gulp.task('sass', function () {
return gulp.src('assets/css/main.scss')
.pipe(sass({
includePaths: ['css'],
onError: browserSync.notify
}))
.pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
.pipe(gulp.dest('_site/assets/css'))
.pipe(browserSync.reload({stream:true}))
.pipe(gulp.dest('assets/css'));
});
/**
* Compile files from _pugfiles into _includes (for live injecting) and site (for future jekyll builds)
*/
gulp.task('pug', function(){
return gulp.src('_pugfiles/*.pug')
.pipe(pug())
.pipe(gulp.dest('_includes'));
});
/**
* Watch scss files for changes & recompile
* Watch html/md files/pug files, run jekyll & reload BrowserSync
*/
gulp.task('watch', function () {
gulp.watch('assets/css/**', ['sass']);
gulp.watch(['*.html', '_layouts/*.html', '_includes/*'], ['jekyll-rebuild']);
gulp.watch(['_pugfiles/*.pug'], ['pug']);
});
/**
* Default task, running just `gulp` will compile the sass,
* compile the jekyll site, launch BrowserSync & watch files.
*/
gulp.task('default', ['browser-sync', 'watch']);
node version 10.4.1
npm version 6.4.1
gulp CLI 3.9.1
gulp Local 3.9.1
node.js npm gulp saas
node.js npm gulp saas
edited Jan 1 at 4:34
juscuizon
asked Jan 1 at 0:54
juscuizonjuscuizon
2119
2119
We will need to see your gulpfile.js at least.
– Mark
Jan 1 at 4:18
@Mark Updated the question, you have any idea why this is happening?
– juscuizon
Jan 1 at 5:46
add a comment |
We will need to see your gulpfile.js at least.
– Mark
Jan 1 at 4:18
@Mark Updated the question, you have any idea why this is happening?
– juscuizon
Jan 1 at 5:46
We will need to see your gulpfile.js at least.
– Mark
Jan 1 at 4:18
We will need to see your gulpfile.js at least.
– Mark
Jan 1 at 4:18
@Mark Updated the question, you have any idea why this is happening?
– juscuizon
Jan 1 at 5:46
@Mark Updated the question, you have any idea why this is happening?
– juscuizon
Jan 1 at 5:46
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53992405%2fgulp-sass-gives-error-after-2-or-3-saves-from-my-editor%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53992405%2fgulp-sass-gives-error-after-2-or-3-saves-from-my-editor%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
We will need to see your gulpfile.js at least.
– Mark
Jan 1 at 4:18
@Mark Updated the question, you have any idea why this is happening?
– juscuizon
Jan 1 at 5:46