npm或cnpm install 安装tui-editor报错解决方案,亲测有效

IT 文章1周前更新 小编
0 0 0

有很多同学在使用vue开发项目时,可能会用的到类似vue-element-admin的模板进行开发,老版本的项目在npm install时往往或报错tui-editor安装失败,这是一个编辑器插件,最近潘老师在安装时也遇到了该问题,我们一起来看看是怎么解决的吧!

一、产生原因

其实这个问题产生的原因很简单,就是原先的tui-editor插件(富文本编辑器插件)换了个名称,现在已经更名为toast-ui/editor因此安装不了,从而报错!

二、解决方案

解决方案其实也很简单,具体如下:

ad

程序员导航

优网导航旗下整合全网优质开发资源,一站式IT编程学习与工具大全网站

第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步:方法更名

1)把该页面(还是第二步中的文件)的getValuesetValue分别换成getMarkdownsetMarkdown

2)把页面中的所有tui-editor全部替换为@toast-ui/editor

ad

AI 工具导航

优网导航旗下AI工具导航,精选全球千款优质 AI 工具集

第4步:重新安装

重新执行npm install安装依赖就解决了。

总结

以上就是npm或cnpm install 安装tui-editor报错时的解决方案,亲测有效哦!

© 版权声明

相关文章

暂无评论

  • chayu
    chayu 游客

    ERROR  Failed to compile with 2 errors                                                                                      23:54:26These dependencies were not found:* @toast-ui/editor in ./node_modules/cache-loader/dist/cjs.js??ref–12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref–0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/MarkdownEditor/index.vue?vue&type=script&lang=js&* @toast-ui/editor/dist/toas@toast-ui/editor.css in ./node_modules/cache-loader/dist/cjs.js??ref–12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref–0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/MarkdownEditor/index.vue?vue&type=script&lang=js&To install them, you can run: npm install –save @toast-ui/editor @toast-ui/editor/dist/toas@toast-ui/editor.cssError from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'

    青海
    回复