Building fresh packages...
[-/5] ? waiting...
[-/5] ? waiting...
[3/5] ? electron
[4/5] ? phantomjs-prebuilt
[5/5] ? electron-chromedriver
今天下午一直就是在折騰這個東西,公司我直接就能裝上,家里我掛了全局代理,還是不行,最后我甚至重裝了我的電腦!還是沒能解決。
image.png
在Github上面搜索到了一個Issues,一開始自己沒有仔細看,上面其實有一個答案的。我是搜索phantomjs-prebuilt這個模塊,發(fā)現(xiàn)了一個這個。
phantomjs_cdnurl=https://bitbucket.org/ariya/phantomjs/downloads
通過這個了解到了,.npmrc和.yarnrc,發(fā)現(xiàn)還有一些其他的參數(shù)影響到了依賴的下載。通過設(shè)置這些參數(shù),解決的下載的問題。
在項目根目錄下面創(chuàng)建.yarnrc(如果使用npm包管理器創(chuàng)建.npmrc)文件,配置以下參數(shù)。
registry "https://registry.npm.taobao.org"
sass_binary_site "https://npm.taobao.org/mirrors/node-sass/"
phantomjs_cdnurl "http://cnpmjs.org/downloads"
electron_mirror "https://npm.taobao.org/mirrors/electron/"
sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/"
profiler_binary_host_mirror "https://npm.taobao.org/mirrors/node-inspector/"
chromedriver_cdnurl "https://cdn.npm.taobao.org/dist/chromedriver"

TIM截圖20190905233049.png
當(dāng)然還有其他的很多參數(shù),具體參數(shù)查看https://npm.taobao.org/mirrors
2021.12.31 更新
文件格式更新為如下 多了等號
registry="https://registry.npm.taobao.org"
sass_binary_site="https://npm.taobao.org/mirrors/node-sass/"
phantomjs_cdnurl="http://cnpmjs.org/downloads"
electron_mirror="https://npm.taobao.org/mirrors/electron/"
sqlite3_binary_host_mirror="https://foxgis.oss-cn-shanghai.aliyuncs.com/"
profiler_binary_host_mirror="https://npm.taobao.org/mirrors/node-inspector/"
chromedriver_cdnurl="https://cdn.npm.taobao.org/dist/chromedriver"
希望能夠幫助到遇到和我一樣問題的人。