[英]gitlab ci throwing error for angular project
我最近開始在Anglab項目的gitlab-ci中獲取CI錯誤
錯誤如下
$ npm install --unsafe-perm -g --save-dev @angular/cli@1.3.2
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
> node-sass@4.5.3 install /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/linux_musl-x64-59_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.3/linux_musl-x64-59_binding.node":
HTTP error 404 Not Found
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
我知道文件https://github.com/sass/node-sass/releases/download/v4.5.3/linux_musl-x64-59_binding.node
不存在,但是我不確定為什么node-sass
在嘗試安裝該版本的文件?
問題在於節點版本控制。 在我的gitlab-ci中,我使用的是最新的節點docker映像( node:alpine
),並且截至2017年10月31日, node:alpine
標記已移至節點版本9.xx
因此,這破壞了node-sass僅作為node-sass自 4.5.3
版開始最多支持8.XX
我將節點8.XX
映像切換為支持節點8.XX
node:carbon-alpine
並修復了問題。
首先清除npm緩存:
npm cache clean
然后全局安裝node-sass:
npm install -g node-sass@4.5.3
然后運行命令:
npm install --unsafe-perm -g --save-dev @angular/cli@1.3.2
如果仍然無法使用,請嘗試使用yarn安裝:
yarn add node-sass
然后運行你的命令
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.