vue-element-admin在git 上 clone 之后无法install

一. 无法install的原因

因为vue-element-admin引入的富文本编辑插件所导致 由于tui-editor变更 名字 导致 依赖查询找不到对应的版本

二. 解决的办法

  1. 先删掉package.json中tui-editor:1.3.3

  1. 找到 \src\components\MarkdownEditor\index.vue 把所有的import 替换成下面4个

import 'codemirror/lib/codemirror.css' // codemirror
import '@toast-ui/editor/dist/toastui-editor.css'

import Editor from '@toast-ui/editor'
import defaultOptions from './default-options'

b. 在当前的文件下 替换一下方法和名字

所有 editor.getValue 替换成 editor.getMarkdown
所有 editor.setValue 替换成 editor.setMarkdown
所有 editor.getHtml 替换成 editor.getHTML
所有 editor.remove() 替换成 editor.destroy()

c. 找到刚才引入的文件 default-options 替换里面的toolbarItems

toolbarItems: [
    ['heading', 'bold', 'italic', 'strike'], ['hr', 'quote'], ['ul', 'ol', 'task', 'indent', 'outdent'], ['table', 'image', 'link'], ['code', 'codeblock']
  ]
  1. 找到 src/views/components-demo/markdown.vue 的 toolbarItems替换为[['heading','bold','italic']]

  1. npm install --save @toast-ui/vue-editor

  1. 再执行npm install 或 npm install --registry=registry.npm.taobao.org就可以

三,如果上述步骤做完执行install 出现一下错误[email protected] dev: vue-cli-service serve

  1. 第一种就是 删除node_modules 重新下载

  1. 第二种在第一种办法无效的情况下

  1. 系统环境变量的path中添加C:\windows\system32(具体路径是:右击我的电脑=>属性=>高级系统设置=>环境变量=>path),如果有可忽略直接第二步

  1. 项目中的vue.config.js 中 open:true 注释掉或者 改成false,意思是运行完程序后,不自动启动浏览器

猜你喜欢

转载自blog.csdn.net/qq_37564189/article/details/129147751