2017-08-12 124 views
0

我努力學習laravel和Windows 10Laravel SCSS編譯失敗

成立了一個新的項目,作曲家,如果我嘗試編譯

資源\資產\青菜\ app.scss

我有以下錯誤

Compilation Error 
Error: File "c:\Users\Michael\www\demolaravel\resources\assets\sass\node_modules\bootstrap-sass\assets\stylesheets\bootstrap" not found 
on line 9 of sass/c:\Users\Michael\www\demolaravel\resources\assets\sass\app.scss 
>> @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 

爲什麼他抱怨有關DIR - 也app.css(至少在這個特定的行)是原來的。這是作曲家安裝它的方式。

// Fonts 
@import url("https://fonts.googleapis.com/css?family=Raleway:300,400,600"); 

// Variables 
@import "variables"; 

// Bootstrap 
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 

body{ 
    padding-top: 80px; 
} 

我只是在最後 我與Visual Studio代碼和現場SASS編譯器擴展工作增加了車身選擇。但我也試過童子軍應用 還試圖puting的絕對路徑,但沒有工作:(

+1

您是否在項目中使用'npm install'安裝了依賴項? –

+0

不,我忘了。讓這個答案,我接受 –

回答

1

看來你沒有安裝所有節點的依賴性。

運行此命令npm install您的項目。

@import 寫這樣

@import "../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 

編譯新的CSS與npm run dev

+0

對不起,我做了npm安裝,它安裝了很多文件,但如果我現在改變我的scss,讓它編譯我得到相同的消息。 :( –

+0

是「node_modules \ bootstrap-sass」存在 –

+0

似乎elixir試圖從'sass'文件夾中找到文件並追加路徑,所以嘗試從sass目錄中找到這個路徑node_modules向後3步。@import「 ../../../ node_modules/bootstrap-sass/assets/stylesheets/bootstrap「;' –

0

首先請確保您在全球安裝了nodenpm。然後從您的項目中刪除node_modules目錄,並運行

npm rebuild node-sass 

此命令可能需要一些時間來執行。之後,進入您的項目目錄並運行npm install。然後用laravel-mix編譯您的資產。

我也遇到了同樣的問題,在linux環境和我遇到了這個解決方案。

+0

您現在也可以使用Visual Studio代碼的live sass編譯器擴展。但是,只有當我在我的'@ import'中跳出三個dirs時,像 '@import「../../../ node_modules/bootstrap-sass/assets/stylesheets/bootstrap」;'Thank you –