1. 程式人生 > 其它 >vue-element-admin npm install --registry=https://registry.npm.taobao.org ERR code128 問題

vue-element-admin npm install --registry=https://registry.npm.taobao.org ERR code128 問題

F:\vue-element-admin>npm install --registry=https://registry.npm.taobao.org
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://[email protected]/nhn/raphael.git
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Program Files\nodejs\node_cache\_logs\2022-06-01T09_19_28_290Z-debug-0.log
# 克隆專案
git clone https://github.com/PanJiaChen/vue-element-admin.git

# 進入專案目錄
cd vue-element-admin

# 安裝依賴
npm install

# 建議不要用 cnpm 安裝 會有各種詭異的bug 可以通過如下操作解決 npm 下載速度慢的問題
npm install --registry=https://registry.npm.taobao.org

# 本地開發 啟動專案
npm run dev

但是 package.json 裡面的依賴因為版本問題,在npm install 的時候會出現git 延遲
解決方式:

找了一圈 下面方法驗證成功

找到無法下載的依賴就是 tui-editor
修改package.json檔案
將 “tui-editor”: “1.3.3” 替換成 “@toast-ui/editor”: “^3.1.3”

找到 src/components/MarkdownEditor/index.vue 檔案修改程式碼
1.import 'tui-editor/dist/tui-editor.css' 替換成 import '@toast-ui/editor/dist/toastui-editor.css'

2.import Editor from 'tui-editor' 替換成 import Editor from '@toast-ui/editor'

3.刪除 import 'tui-editor/dist/tui-editor-contents.css'

4.將所有 editor.getValue 替換成 editor.getMarkdown

5.將所有 editor.setValue 替換成 editor.setMarkdown

6.將 editor.getHtml 替換成 editor.getHTML
————————————————
版權宣告:本文為CSDN博主「美味的濃湯」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處連結及本宣告。
原文連結:https://blog.csdn.net/qq_22473207/article/details/124863039