Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-sass安装问题 #7

Open
peachlemon opened this issue Aug 31, 2016 · 0 comments
Open

node-sass安装问题 #7

peachlemon opened this issue Aug 31, 2016 · 0 comments

Comments

@peachlemon
Copy link
Owner

前端工程中运用到sass编写css时,往往工程化中需要运用到编译sass的第三方插件,如webpack的sass-loader加载器。而此加载器依赖于node-sass。国内被墙经常导致无法安装node-sass,主要原因是无法download不同系统的sass基于ruby的编译器。

  • 现象
    当npm install node-sass时,报错信息:‘Cannot download “http://github.com/xxx/xxx/win32.xxx.node”’错误,后面还建议你想过的解决方案。
  • 建议的那种方案,是使用代理解决,但是绝大部分搭建的代理在命令行中无法翻墙(当然你可以尝试修改下DNS试试)。但是把error message那串download文件地址copy到浏览器是能访问并且下载。
  • 接着你要做的就是下载编译器到自定义目录中(如:D://xxx),这样本地就由编译器了,由于npm install去寻找编译器的地址,是它指定的目录。 所以要修改下node-sass编辑器环境变量的位置。具体操作:set SASS_BINARY_PATH=D://XXX
  • 上面的set设置只是临时的设置,建议你在计算机 > 高级设置中去设置永久性的环境变量。
  • 上面操作完后,node-sass安装时,就会检测是否有.node文件存在,如果存在就不会再去下载,这样node-sass就可以顺利的完成依赖。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant