一、緣起
tinyMCE是一個(gè)富文本編輯器,License是LGPL-2.1,不是MIT,我想研究一下它,并且開(kāi)發(fā)一些自定義插件,所以,打算從github上下載源碼跑一下。
二、地址
- 官網(wǎng)地址:https://www.tiny.cloud
- github地址:https://github.com/tinymce/tinymce
- 自定義下載插件地址:https://www.tiny.cloud/get-tiny/custom-builds/ 不過(guò)好像是V4的,我測(cè)試使用的是是V5,沒(méi)大用,算是為V4版的提供福利;
三、環(huán)境
- os:win10
- 包管理工具:yarn (tinyMEC不允許使用npm安裝)
- tinyMEC版本:5.0.12
四、安裝
1. 下載代碼
git clone https://github.com/tinymce/tinymce.git
2.安裝
在項(xiàng)目目錄下(tinymce)使用yarn安裝,再次強(qiáng)調(diào):只能使用yarn,不能使用npm
yarn
3. 報(bào)錯(cuò)信息摘要
控制臺(tái)打印信息:
An unexpected error occurred: "http://nexus:8081/repository/npm-group/@ephox/wrap-promise-polyfill/-/wrap-promise-polyfill-2.2.0.tgz: getaddrinfo ENOTFOUND nexus nexus:8081
錯(cuò)誤日志文件:
Trace:
Error: getaddrinfo ENOTFOUND nexus nexus:8081
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
4.分析原因
我試著訪問(wèn)了一下控制臺(tái)提示的鏈接,無(wú)法訪問(wèn),查了一下 nexus,發(fā)現(xiàn)是搭建私服用的軟件。難道我的yarn 的 registry 設(shè)置錯(cuò)了?我覺(jué)得應(yīng)該不是,因?yàn)槲覐膩?lái)沒(méi)使用過(guò)私服,為了確認(rèn),我執(zhí)行:
yarn config get registry
打印結(jié)果如下:
https://registry.yarnpkg.com
沒(méi)問(wèn)題啊。。。
百度無(wú)果,查看源代碼的時(shí)候發(fā)現(xiàn)了 .yarnrc文件,打開(kāi)查看內(nèi)容:
--install.frozen-lockfile true
workspaces-experimental true
果然有特殊設(shè)置,在yarn官網(wǎng)找到了解釋?zhuān)?br> install.frozen-lockfile:
If you need reproducible dependencies, which is usually the case with the continuous integration systems, you should pass --frozen-lockfile flag.
有道詞典翻譯結(jié)果:
如果您需要可重現(xiàn)的依賴關(guān)系,這通常是連續(xù)集成系統(tǒng)的情況,那么您應(yīng)該傳遞——frozen-lockfile標(biāo)志
workspaces-experimental:
Workspaces are stable enough to be used in large-scale applications and shouldn’t change anything from the way the regular installs work, but if you think they’re breaking something, you can disable them by adding the following line into your Yarnrc file:
workspaces-experimental false
有道詞典的翻譯結(jié)果是:
工作區(qū)足夠穩(wěn)定,可以用于大型應(yīng)用程序,不應(yīng)該改變常規(guī)安裝的工作方式,但如果您認(rèn)為它們破壞了某些東西,可以通過(guò)在Yarnrc文件中添加以下行來(lái)禁用它們
大概就是某些安裝項(xiàng)被禁了。
5. 解決
刪除這個(gè)文件,重新安裝,成功!