npm install失败的分析与解决方案,以及修复完成的代码地址

问题描述:

在这里插入图片描述

在引入vue-element-admin后npm i 初始化失败,或者对下载的vue项目npm i 任何插件都会失败,且安装依赖时报错 npm ERR! Error while executing

npm ERR! Error while executing:
npm ERR! H:\Program Files\git\Git\cmd\git.EXE ls-remote -h -t https://github.com/nhn/raphael.git
npm ERR!
npm ERR! fatal: unable to access 'https://github.com/nhn/raphael.git/': Recv failure: Connection was reset
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR!     H:\Program Files\nodejs\node_cache\_logs\2023-03-02T01_25_58_031Z-debug.log

只要是报错npm ERR! exited with error code: 128基本都一样!

原因分析:

本失败原因是由于tui-editor(富文本编辑器插件)更名造成的,现在已经更名为toast-ui/editor
并且该插件还进行了文件名的更名以及方法名的更名。

第一种解决方案:
将 package.json里面的“tui-editor”那一行删除(最简单直接的!)

第二种解决方案:
(在想继续使用这里tui-editor的前提下)
解决方案如下:
1.首先将package.json中的tui-editor那一行修改为"@toast-ui/editor": “^3.1.3”,

2.进入\src\components\MarkdownEditor\index.vue文件,将他的所有import删除换成下面四行
import ‘codemirror/lib/codemirror.css’
import ‘@toast-ui/editor/dist/toastui-editor.css’
import Editor from ‘@toast-ui/editor’
import defaultOptions from ‘./default-options’

3.把该页面(还是第二条中的文件)的getValue和setValue分别换成getMarkdown和setMarkdown
把页面中的所有tui-editor全部替换为@toast-ui/editor

4.保存文件,npm install即可。

或者直接去这家伙修复好的项目地址克隆项目文件(gitee):https://gitee.com/constfiv/vue-element-admin-fix-install-problem

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

BinParker

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值