node-sass 升级 sass
安装依赖
方案一
package
依赖覆盖
"overrides": {
"node-sass": "npm:sass@^1.55.0"
},
"resolutions": {
"node-sass": "npm:sass@^1.55.0"
}
- 创建软连接
ln -s $PWD/node_modules/sass $PWD/node_modules/node-sass
方案二
未经验证,理论上可行。和方案一类似,但会更彻底一些。
-
自行下载 node,强制降级版本
-
安装依赖并忽略
postinstall
脚本--ignore-scripts
-
安装
sass
,删除node-sass
并软链到sass
#!/usr/bin/env bash
echo "installing alinode..."
if [ "$(uname)" == "Darwin" ]; then
echo "download alinode for mac"
curl -L https://registry.npmmirror.com/-/binary/alinode/v3.9.0/alinode-v3.9.0-darwin-x64.tar.gz > ./node.tar.gz
else
echo "download alinode for linux"
curl -L https://registry.npmmirror.com/-/binary/alinode/v3.9.0/alinode-v3.9.0-linux-x64.tar.gz > ./node.tar.gz
fi
mkdir ./node_modules
mkdir ./node_modules/node8
tar xf ./node.tar.gz -C ./node_modules/node8 --strip-components=1
echo "node version => "<n>./node_modules/node8/bin/node -v
echo "installed alinode"
# 安装依赖
./node_modules/node8/bin/node ./node_modules/node8/bin/npm install --registry=https://registry.anpm.alibaba-inc.com --ignore-scripts
./node_modules/node8/bin/node ./node_modules/node8/bin/npm install sass --registry=https://registry.anpm.alibaba-inc.com --ignore-scripts