mac用npm安装gyp报错:NPM Error:gyp: No Xcode or CLT version detected!
执行如下命令
sudo rm -rf $(xcode-select -print-path) xcode-select --install
node-sass 及 node-gyp 安装失败
报错如下
... gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 ... npm ERR! node-sass@4.7.2 postinstall: `node scripts/build.js` npm ERR! Exit status 1 ...
node-sass 以及 node-gyp 在安装的时候,会自动去找国外的源进行下载,而这个源并不是非常的稳定。请注意,这个不稳定并不全是由于国内墙的存在造成的,因为就算你开了 VPN,这个问题还是会发生。
所以最好的解决办法就是用淘宝镜像 cnpm:
npm install -g cnpm --registry=https://registry.npm.taobao.org