安装node-sass及报错后解决方案

使用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就能够 

相关文章
相关标签/搜索