I'm behind a corporate firewall, proxying the npm repository with Nexus. During the post install step, node-sass tries to curl from https://github.com/sass/node-sass/releases/download/v3.10.1/linux-x64-48_binding.node but fails due to the firewall. Adding a firewall rule to let the request get through is not an option. If it's possible to also proxy Github through Nexus, that may be an option but I haven't been able to get that configuration working when I've tried.
This is also for a Jenkins build, so having the developer do a npm rebuild node-sass
after the failed install is not an option. I need the install to work, or the Jenkins build will fail.
Is there any way to install node-sass from just the npm registry without also having to download anything from other sources during the post-install step?
To check the version, run the command: sass –version. The latest version is 1.49.
You can install Sass globally using npm install -g sass which will provide access to the sass executable. You can also add it to your project using npm install --save-dev sass . This provides the executable as well as a library: const sass = require('sass'); const result = sass.
node-sass and Sass are both open source tools. It seems that Sass with 12K GitHub stars and 1.93K forks on GitHub has more adoption than node-sass with 6.49K GitHub stars and 949 GitHub forks.
Node-sass is a library that provides binding for Node. js to LibSass, the C version of the popular stylesheet preprocessor, Sass. It allows you to natively compile . scss files to css at incredible speed and automatically via a connect middleware. Find it on npm: https://www.npmjs.com/package/node-sass.
You can install the the node-sass using
npm install node-sass --sass-binary-site=http://example.com/ or
npm install node-sass --sass-binary-path=<your binary file>
the binary file can be downloaded from github.
Or you can add the flowing line to .npmrc
# change the /home/wangxiang/linux-x64-72_binding.node to your real path
sass_binary_path=/home/wangxiang/linux-x64-72_binding.node
and then:
npm install node-sass
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With