日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

npm install安裝報錯 gyp info it worked if it ends with ok

作者:qq_45925576 更新時間: 2022-02-28 編程語言

前端vue新項目 npm install安裝報錯 gyp info it worked if it ends with ok

1.可能原因1:node和node-sass版本沖突,

對應的node和node-sass的版本如下
在這里插入圖片描述

2.node.js卸載與安裝

之前有安裝過弄過node.js的
如果node.js版本過高需要重新安裝低版本node.js,在控制面板卸載node.js,
在這里插入圖片描述

再在node官網下載對應的msi包安裝到之前的安裝過node.js的文件夾下。低版本的node.js 只需直接下載高版本的msi包安裝無需卸載之前的低版本node.js,這樣不需要再去配置環境變量啥的,

3.node-sass卸載安裝,

node-sass卸載:
npm uninstall node-sass

node-sass安裝可以指定版本:
npm install node-sass 布置的版本直接安裝
npm install node-sass@4.14.0 指定4.14版本的,

如果安裝報錯試試換下淘寶鏡像,一個好的解決方案在是直接在項目根目錄下創建一個 .npmrc文件指定淘寶鏡像
在這里插入圖片描述

文件內容:
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/ electron_mirror=https://npm.taobao.org/mirrors/electron/ registry=https://registry.npm.taobao.org

4.安裝好后對應版本的node和node-sass后啟動

再npm install , npm run dev 沒有報錯啦

原文鏈接:https://blog.csdn.net/qq_45925576/article/details/121790494

欄目分類
最近更新