How to get yarn install --offline with node-sass working?

旧街凉风 提交于 2020-01-13 02:16:52

问题


I am trying to use yarn in offline mode because the build server I am using does not have access to yarn registry or github.com.

I found this article on how to use yarn in offline mode which works great until I added node-sass.

It appears even if you use yarn install --offline, node-sass will go to github.com to download libsass.

Is there a way to instruct node-sass to use an offline version of libsass instead of going to github.com?


回答1:


As @jonrsharpe pointed out, you need to use either --sass-binary-site, --sass-binary-name or --sass-binary-path to to tell node-sass where to find libsass. In my case I ended up using sass-binary-path.

So the first thing I did was download the Windows version of libsass here. I downloaded the _binding.node version because I assumed the _binding.pdb version is a debugging file.

I my case I created a .yarnrc that looks like the below:

yarn-offline-mirror "////sharedrive//folder"
yarn-offline-mirror-pruning true
sass-binary-path "////sharedrive//folder//win32-ia32-47_binding.node"

With the Windows version all / needed to be escaped with //. sass-binary-path needed the libsass binary at the end which in the above case is win32-ia32-47_binding.node.

So with all that everything worked great.



来源:https://stackoverflow.com/questions/45424094/how-to-get-yarn-install-offline-with-node-sass-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!