2016-08-30 37 views
0

好吧,首先我做了這個。增加了對環境變量的ruby PATH,仍然有`grunt sass`不起作用

>grunt sass 
Running "sass:dist" (sass) task 
Warning: 
You need to have Ruby and Sass installed and in your PATH for this task to work. 
More info: https://github.com/gruntjs/grunt-contrib-sass 
Use --force to continue. 

Aborted due to warnings. 

我認爲這是有道理的,我需要添加路徑到紅寶石,所以我做到了。然後我檢查紅寶石的版本,它沒有返回的東西

>ruby -v 
ruby 2.2.5p319 (2016-04-26 revision 54774) [x64-mingw32] 

這意味着我已經安裝了紅寶石。現在咕嚕聲應該可以工作,但它不會,我得到的是同樣的舊信息。 這一個:

>grunt sass 
Running "sass:dist" (sass) task 
Warning: 
You need to have Ruby and Sass installed and in your PATH for this task to work. 
More info: https://github.com/gruntjs/grunt-contrib-sass 
Use --force to continue. 

Aborted due to warnings. 

UPDATE

我得到當我運行grunt-sass-force如下:

>grunt sass --force 
Running "sass:dist" (sass) task 
Warning: 
You need to have Ruby and Sass installed and in your PATH for this task to work. 
More info: https://github.com/gruntjs/grunt-contrib-sass 
Used --force, continuing. 
'sass' is not recognized as an internal or external command, 
operable program or batch file. 
Warning: Exited with error code 1 Used --force, continuing. 

Done, but with warnings. 
+0

當你使用''--force''時會發生什麼?你安裝了''sass''嗎? – zhon

+0

@zhon 你的意思是這樣的: 'grunt sass --force'? 當我做'我獲得以下咕嚕 - 薩斯 - force' >咕嚕青菜--force 運行「頂嘴:DIST」(SASS)任務 警告: 你需要有紅寶石和薩斯安裝在你的此任務的工作路徑。 更多信息:https://github.com/gruntjs/grunt-contrib-sass 使用 - 力量,繼續。 'sass'不被識別爲內部或外部命令, 可操作的程序或批處理文件。 警告:退出並顯示錯誤代碼1使用 - 強制,繼續。 完成,但有警告。 – user4913383

+0

您是否安裝了''sass''寶石? – zhon

回答

1

看來,你需要與gem install sass安裝sass。沒有寶石,你不能在紅寶石中使用sass。

0

Sass最初是使用ruby programming language構建的。一個node構建系統(即,gruntgulpwebpack)上運行的薩斯需要同時運行rubySass和方式將它們連接起來(即,grunt-contrib-sassgulp-sasssass-loader)。

Ruby插件被稱爲gems,安裝插件很簡單:

gem install sass 

在另一方面,libsassSass一個c實現不需要ruby。安裝libsass後,您需要一種方法將libsass連接到node。你可以用node-sass來做到這一點。

npm install node-sass 

最後,LESS是競爭對手Sass運行在node,不會要求rubylibsass