如何在ubuntu安装sass预处理器
Sass(英文全称:Syntactically Awesome Stylesheets)是一个最初由Hampton Catlin设计并由Natalie Weizenbaum开发的层叠样式表语言,在开发最初版本之后,Weizenbaum和Chris Eppstein继续通过SassScript来继续扩充Sass的功能。SassScript是一个在Sass文件中使用的小型脚本语言在本教程中,我们使用Ubuntu安装Sass预处理器,如果直接安装node-sass的话,你也可能会遇到下面的错误
error xxx/node_modules/node-sass-middleware/node_modules/node-sass: Command failed.Exit code: 135
Command: sh
Arguments: -c node scripts/build.js
Directory: xxxx/node_modules/node-sass-middleware/node_modules/node-sass
Output:
Binary found at xxx/node_modules/node-sass-middleware/node_modules/node-sass/vendor/linux-x64-51/binding.node
Testing binary
Bus error (core dumped)
如果你创建express项目使用sass也会有同样的错误
Bus error (core dumped)npm ERR! Linux 4.4.0-57-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/lib/node_modules/npm/bin/npm-cli.js" "run" "start"
npm ERR! node v7.0.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node ./bin/www`
npm ERR! Exit status 135
npm ERR!
npm ERR! Failed at the [email protected] start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/huangyanxiong/language/javascript/node/express/sass/npm-debug.log
解决方式
➜ sudo apt search sass |grep lib➜ sudo apt-get install
➜ sudo apt-get install libsass-dev
RedHat,Fedora,Centos
➜ sudo yum search sass | grep lib➜ sudo yum install packname
如果上面的方式还没能安装好,你也可以尝试编译安装
sudo apt-get install libssl-devsudo apt-get install zlib1g-dev
mkdir ~/rubysass && cd ~/rubysass
wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
wget https://rubygems.org/rubygems/rubygems-2.6.7.zip
sudo apt-get update && sudo apt-get install -y tar unzip
tar zxvf ruby-2.3.1.tar.gz && unzip rubygems-2.6.7.zip
cd ruby-2.3.1
./configure && make && sudo make install
cd ~/rubysass/rubygems-2.6.7
sudo ruby setup.rb
cd ~ && sudo gem install sass
以上是 如何在ubuntu安装sass预处理器 的全部内容, 来源链接: utcz.com/z/506905.html