我试图从grunt-contrib-sass切换到grunt-sass,但是我在grunt包装器模块中遇到了与node-sass相关的构建错误。到目前为止,我已将节点从0.10.40升级到0.12.7并切换到Python 2.7以绕过其他一些节点,但这仍然是:
$ npm install
> node-sass@1.0.3 install /var/www/html/example.com/www/node_modules/grunt-sass/node_modules/node-sass
> node build.js
child_process: customFds option is deprecated, use stdio instead.
make: Entering directory `/var/www/html/example.com/www/node_modules/grunt-sass/node_modules/node-sass/build'
CXX(target) Release/obj.target/binding/binding.o
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [Release/obj.target/binding/binding.o] Error 1
make: Leaving directory `/var/www/html/example.com/www/node_modules/grunt-sass/node_modules/node-sass/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 2.6.18-274.18.1.el5.centos.plus
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/html/example.com/www/node_modules/grunt-sass/node_modules/node-sass
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
Build failed
npm ERR! Linux 2.6.18-274.18.1.el5.centos.plus
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! node-sass@1.0.3 install: `node build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@1.0.3 install script 'node build.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/example.com/www/npm-debug.log
其他版本信息:
$ node -v
v0.12.7
$ node -v
v0.12.7
$ npm -v
2.11.3
$ cat /etc/redhat-release
CentOS release 5.11 (Final)
我在解决Node.js兼容性问题方面有点深入了解。虽然这是在共享的开发环境中进行的,但我愿意尝试一些没有像升级操作系统那样的大规模全局变化。
更新:我已经解决了这个问题,方法是从本地node_modules文件夹中手动删除node-sass和node-gyp。运行之后,npm install运行没有错误。我认为这些模块是早期尝试的遗留问题(最有可能在升级node.js和Python之前)。