问题
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