使用npm install 命令安裝node-sass時,常常出現安裝失敗的狀況。緣由在於npm服務器在美國,還有就是某強大的防火牆做用。致使模塊沒法下載。css
1 npm install node-sass
1 Cannot download https://github.com/sass/node-sass/releases/download/v3.4.2/win32-x64-46_binding.node 2 3 Hint: If github.com is not accessible in your location 4 try setting a proxy via HTTP_PROXY, e.g. 5 export HTTP_PROXY=http://example.com:1234 6 or configure npm proxy via 7 npm config set proxy http://example.com:8080'
解決方法:
一、使用淘寶鏡像完成安裝。vue
1 npm install -g cnpm --registry=https://registry.npm.taobao.org 2 cnpm install node-sass
在安裝node-sass以後,從新運行會報以下錯誤node
ERROR Failed to compile with 1 errors 16:47:39git
This dependency was not found:github
* !!vue-style-loader!css-loader?{"sourceMap":true}!../../node_modules/vue-loader/lib/style-compiler/index?{"vue":true,"id":"data-v-742a2c37","scoped":true,"has
InlineConfig":false}!sass-loader?{"sourceMap":true}!../../node_modules/vue-loader/lib/selector?type=styles&index=0!./signInBg.vue in ./src/components/signInBg.
vuenpm
To install it, you can run: npm install --save !!vue-style-loader!css-loader?{"sourceMap":true}!../../node_modules/vue-loader/lib/style-compiler/index?{"vue":t
rue,"id":"data-v-742a2c37","scoped":true,"hasInlineConfig":false}!sass-loader?{"sourceMap":true}!../../node_modules/vue-loader/lib/selector?type=styles&index=0
!./signInBg.vue sass
解決思路:服務器
1. npm install sass-loader --save;spa
2. npm install node-sass --save;code
而後運行npm run dev就能夠