在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! sass@0.0.0 start: `node ./bin/www`  
npm ERR! Exit status 135  
npm ERR!  
npm ERR! Failed at the sass@0.0.0 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

如果没有请自行编译

你的欣赏是我最大的动力

Yanxiong Huang

My name is Yanxiong Huang. graduated from Nanyang middle school.Love Linux,familiar with Node.js,Docker,Serverless... and more Web technology.Contact Me:QQ 31356617;Email:huangaynxiong2013@gmail.com

guangzhou,china http://www.myfreax.com

乐在分享