本文介绍了如何让纱线安装 --offline 与 node-sass 一起工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在离线模式下使用 yarn,因为我使用的构建服务器无法访问 yarn 注册表或 github.com.

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.

我发现了这篇关于如何使用 文章yarn 在离线模式下运行良好,直到我添加了 node-sass.

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

出现即使你使用yarn install --offlinenode-sass也会去github.com下载libsass.

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

有没有办法指示 node-sass 使用 libsass 的离线版本,而不是去 github.com?>

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

推荐答案

正如@jonrsharpe 指出的,你需要使用 --sass-binary-site, --sass-binary-name--sass-binary-path 告诉 node-sass 在哪里可以找到 libsass.就我而言,我最终使用了 sass-binary-path.

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.

所以我做的第一件事就是下载 Windows 版本的 libsass 这里.我下载了 _binding.node 版本,因为我假设 _binding.pdb 版本是一个调试文件.

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.

我创建了一个 .yarnrc,如下所示:

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"

Windows 版本中,所有/ 都需要用// 进行转义.sass-binary-path 最后需要 libsass 二进制文件,在上面的例子中是 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.

所以一切都很好.

这篇关于如何让纱线安装 --offline 与 node-sass 一起工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 10:56