2016-12-29 32 views
0

最近,我的大量任務開始給我帶來錯誤。它不想再編譯我的.scss文件。很奇怪。Gulp'文件中未確認的輸入'

我的一大塊任務似乎運行良好,這是風格任務引發了一個錯誤。

This is my CMD when I try to run the gulp styles command

正如你可以看到它不從dropdowns.scss文件爲有效識別輸入的。

// 
// Dropdown menus 
// -------------------------------------------------- 


// Dropdown arrow/caret 
.caret { 
    display: inline-block; 
    width: 0; 
    height: 0; 
    margin-left: 2px; 
    vertical-align: middle; 
    border-top: $caret-width-base dashed; 
    border-top: $caret-width-base solid \9; // IE8 
    border-right: $caret-width-base solid transparent; 
    border-left: $caret-width-base solid transparent; 
} 

似乎是沒有錯的文件,但是在第13行是第一次調用的變量。當我刪除這個文件時,它會發現其他文件中不能識別的其他scss變量。簡而言之:所有scss變量都無法識別。

// ### Styles 
// `gulp styles` - Compiles, combines, and optimizes Bower CSS and project CSS. 
// By default this task will only log a warning if a precompiler error is 
// raised. If the `--production` flag is set: this task will fail outright. 
gulp.task('styles', ['wiredep'], function() { 
    var merged = merge(); 
    manifest.forEachDependency('css', function(dep) { 
    var cssTasksInstance = cssTasks(dep.name); 
    if (!enabled.failStyleTask) { 
     cssTasksInstance.on('error', function(err) { 
     console.error(err.message); 
     this.emit('end'); 
     }); 
    } 
    merged.add(gulp.src(dep.globs, {base: 'styles'}) 
     .pipe(cssTasksInstance)); 
    }); 
    return merged 
    .pipe(writeToManifest('styles')); 
}); 

我想的Windows 10可能已經做了升級系統或者它可能有事可做,我試圖安裝關鍵的CSS throught NPM。但是,我懷疑這可以摧毀一個完美的任務。

到目前爲止,我嘗試重新安裝node.js bower和gulp本身,但它一直給我這個錯誤。此外,我試圖配置一個新項目(在過去幾個月中每次都有效),但即使是新項目也不會編譯。我在想一些依賴可能已經過時了。

呃,我一直在研究這個問題好幾個小時,而且我對這可能是什麼原因感到無能爲力。

在此先感謝!

+0

步驟會更好,如果你在問題中粘貼輸出因此不必重定向到另一個網頁即可閱讀它(請參閱格式選項)。另外,你是否檢查了你的scss文件中的第13行(並且可以將它粘貼到問題中),因爲這看起來就像你錯誤所在,而不是你的一口氣任務。 – chriskelly

+0

@chriskelly對不起,你說得對。正如你所看到的,dropdown.scss並沒有什麼奇怪的。在第13行,它簡單地陳述了第一個變量。如果我從需要轉換爲CSS它只會與SCSS變量:(顯示在另一個文件錯誤的文件中刪除dropdown.scss –

回答

0

Update2--

Bower.json

{ 
    "name": "starter-template", 
    "homepage": "http://www.thomwensink.nl", 
    "authors": [ 
    "Thom Wensink <[email protected]>" 
    ], 
    "license": "MIT", 
    "private": true, 
    "dependencies": { 
    "bootstrap-sass": "^3.3.6", 
    "slick-carousel": "^1.5.9", 
    "font-awesome": "fontawesome#^4.5.0", 
    "imgLiquid": "^0.9.944", 
    "modernizr": "2.8.2" 
    }, 
    "overrides": { 
    "bootstrap-sass": { 
     "main": [ 
     "./assets/stylesheets/bootstrap/_variables.scss", 
     "./assets/stylesheets/bootstrap/_mixins.scss", 
     "./assets/stylesheets/bootstrap/_normalize.scss", 
     "./assets/stylesheets/bootstrap/_print.scss", 
     "./assets/stylesheets/bootstrap/_scaffolding.scss", 
     "./assets/stylesheets/bootstrap/_type.scss", 
     "./assets/stylesheets/bootstrap/_code.scss", 
     "./assets/stylesheets/bootstrap/_grid.scss", 
     "./assets/stylesheets/bootstrap/_tables.scss", 
     "./assets/stylesheets/bootstrap/_forms.scss", 
     "./assets/stylesheets/bootstrap/_component-animations.scss", 
     "./assets/stylesheets/bootstrap/_navs.scss", 
     "./assets/stylesheets/bootstrap/_navbar.scss", 
     "./assets/stylesheets/bootstrap/_utilities.scss", 
     "./assets/stylesheets/bootstrap/_responsive-utilities.scss", 
     "./assets/javascripts/bootstrap/transition.js", 
     "./assets/javascripts/bootstrap/collapse.js", 
     "./assets/javascripts/bootstrap/scrollspy.js", 
     "./assets/javascripts/bootstrap/affix.js" 
     ] 
    }, 
    "font-awesome": { 
     "main": [ 
     "./scss/font-awesome.scss", 
     "./fonts/*" 
     ] 
    }, 
    "modernizr": { 
     "main": "./modernizr.js" 
    } 
    } 
} 

關於重新安裝引導的錯誤消息,則是沒有的。它如預期那樣。但是,問題依然存在。

Update--

原來,問題是引導版的3.3.5版本。

請問您可以在bower.json中更改引導程序的版本嗎?

來源:

"bootstrap": "~3.3.1", 

要:

"bootstrap": "3.3.1", 

和運行bower install再次,請。


您是否在使用某種gulp-sass插件?下面的代碼是需要從gulp編譯sass到css。您可能需要npm install --save-dev gulp-sass

var sass = require('gulp-sass'); 
gulp.task('sass', function() { 
return gulp.src('client/sass/*.scss') 
    .pipe(sass().on('error', sass.logError)) 
    .pipe(gulp.dest('css')) 
}); 
+0

嗨!是的,我用的是一口 - 薩斯插件。我已經安裝了這個插件。我試圖再次運行此,它成功地安裝操作(雖然它確實給我一個失敗的可選依賴的警告),但問題仍然存在。 –

+0

我已經更新我的答案,你可以嘗試更新從亭子引導文件。看起來你是使用亭子。 – Santosh

+0

感謝您的幫助迄今。但是,更新引導throught鮑爾並沒有幫助。 –

0

安裝一飲而盡,上海社會科學院對於那些有這個問題其他人:我設法解決它下面從this website.