坑貨----win10下的node canvas

在安裝node canvas的時候直接使用npm install canvas結果報錯,具體可能由於canvas一堆依賴並依賴C++,於是查找資料,按照https://my.oschina.net/wangr15/blog/1540126操作的,裝了一堆東西,然後依舊報錯:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cann
ot be found. To build using the v140 build tools, please install v140 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting th
e Project menu or right-click the solution, and then selecting "Upgrade Solution...". [D:\project\service\node_modules\@ctrip\node-vampire-cache\build\binding.vcxpro
j]

這個錯誤是由於vs版本導致的,據說v140是vs2015的,由於我的電腦安裝的是vs2013所以存在找不到v140, 解決方案是安裝vs2015(沒試不知道會不會出別的問題),另外一種是使依賴vs的node服務都使用vs2013,參考的https://github.com/nodejs/node-gyp/issues/679
set GYP_MSVS_VERSION=2013
npm install --msvs_version=2013
最終搞定,可以start起來項目了,windows是真的坑,win10更坑。。。。折騰了一天呢
------------記錄方便查詢

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章