我正在尝试从https://github.com/Kademi/keditor在本地构建keditor。
我做了npm安装,然后做了npm运行构建
我不断收到诸如意外令牌(5:0)之类的错误,但无法确定确切的问题是什么或文件在哪里。
日志如下:
ERROR in ./src/keditor/utils/generateToolbar.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/manu.mehrotra/Downloads/keditor-master 3/src/keditor/utils/generateToolbar.js: Unexpected token (5:0)
3 | import ICON from '../constants/icon';export default function (type, isConfigurable) {let self = this;let options = self.options;let settingBtn = '';switch (type) {case TOOLBAR_TYPE.CONTAINER:case TOOLBAR_TYPE.SUB_CONTAINER:if (isConfigurable) {settingBtn = `<a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.CONTAINER_SETTING}">${ICON.SETTING_CONTAINER}</a>`;}return (`<div class="${CSS_CLASS.UI} ${CSS_CLASS.TOOLBAR} ${CSS_CLASS.TOOLBAR_CONTAINER} ${type === TOOLBAR_TYPE.SUB_CONTAINER ? CSS_CLASS.TOOLBAR_SUB_CONTAINER : ''}"><a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.CONTAINER_MOVE}">${ICON.MOVE_CONTAINER}</a><a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.CONTAINER_MOVE_UP}">${ICON.MOVE_UP_CONTAINER}</a><a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.CONTAINER_MOVE_DOWN}">${ICON.MOVE_DOWN_CONTAINER}</a>${settingBtn}<a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.CONTAINER_CUT}">${ICON.CUT_CONTAINER}</a><a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.CONTAINER_COPY}">${ICON.COPY_CONTAINER}</a><a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.CONTAINER_DELETE}">${ICON.DELETE_CONTAINER}</a></div>`);case TOOLBAR_TYPE.COMPONENT:if (isConfigurable) {settingBtn = `<a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.COMPONENT_SETTING}">${ICON.SETTING_COMPONENT}</a>`;}return (`<div class="${CSS_CLASS.UI} ${CSS_CLASS.TOOLBAR} ${CSS_CLASS.TOOLBAR_COMPONENT}"><a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.COMPONENT_MOVE}">${ICON.MOVE_COMPONENT}</a><a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.COMPONENT_MOVE_UP}">${ICON.MOVE_UP_COMPONENT}</a><a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.COMPONENT_MOVE_DOWN}">${ICON.MOVE_DOWN_COMPONENT}</a>${settingBtn}<a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.COMPONENT_CUT}">${ICON.CUT_COMPONENT}</a><a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.COMPONENT_COPY}">${ICON.COPY_COMPONENT}</a><a href="javascript:void(0);" class="${CSS_CLASS.UI} ${CSS_CLASS.COMPONENT_DELETE}">${ICON.DELETE_COMPONENT}</a></div>`);case TOOLBAR_TYPE.CONTENT_AREA:return (`<div class="${CSS_CLASS.UI} ${CSS_CLASS.TOOLBAR_CONTENT_AREA}"><a href="javascript:void(0)" class="${CSS_CLASS.UI} ${CSS_CLASS.BTN} ${CSS_CLASS.BTN_DEFAULT} ${CSS_CLASS.ADD_CONTENT}" title="${options.locale.addContent}">${ICON.ADD_CONTENT}</a></div>`);case TOOLBAR_TYPE.CONTAINER_CONTENT:case TOOLBAR_TYPE.SUB_CONTAINER_CONTENT:return (`<div class="${CSS_CLASS.UI} ${CSS_CLASS.TOOLBAR_CONTAINER_CONTENT}"><a href="javascript:void(0)" class="${CSS_CLASS.UI} ${CSS_CLASS.BTN} ${CSS_CLASS.BTN_DEFAULT} ${CSS_CLASS.ADD_CONTENT}" title="${options.locale.addContent}">${ICON.ADD_CONTENT}</a></div>`);case TOOLBAR_TYPE.SUB_CONTAINER_BOTTOM:return (`<div class="${CSS_CLASS.UI} ${CSS_CLASS.TOOLBAR} ${CSS_CLASS.TOOLBAR_BOTTOM} ${CSS_CLASS.TOOLBAR_SUB_CONTAINER_BOTTOM}"><a href="javascript:void(0)" class="${CSS_CLASS.UI} ${CSS_CLASS.ADD_CONTENT}" title="${options.locale.addContentBelow}">${ICON.ADD_CONTENT}</a></div>`);case TOOLBAR_TYPE.COMPONENT_BOTTOM:return (`<div class="${CSS_CLASS.UI} ${CSS_CLASS.TOOLBAR} ${CSS_CLASS.TOOLBAR_BOTTOM} ${CSS_CLASS.TOOLBAR_COMPONENT_BOTTOM}"><a href="javascript:void(0)" class="${CSS_CLASS.UI} ${CSS_CLASS.ADD_CONTENT}" title="${options.locale.addContentBelow}">${ICON.ADD_CONTENT}</a></div>`);default:// Do nothing}
4 | };
> 5 |
| ^
at Parser.raise (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:6344:17)
at Parser.unexpected (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:7659:16)
at Parser.parseExprAtom (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:8828:20)
at Parser.parseExprSubscripts (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:8413:23)
at Parser.parseMaybeUnary (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:8393:21)
at Parser.parseExprOps (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:8280:23)
at Parser.parseMaybeConditional (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:8253:23)
at Parser.parseMaybeAssign (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:8200:21)
at Parser.parseExpression (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:8148:23)
at Parser.parseStatementContent (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:9917:23)
at Parser.parseStatement (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:9788:17)
at Parser.parseBlockOrModuleBlockBody (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:10364:25)
at Parser.parseBlockBody (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:10351:10)
at Parser.parseBlock (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:10335:10)
at Parser.parseFunctionBody (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:9408:24)
at Parser.parseFunctionBodyAndFinish (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:9378:10)
at /Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:10498:12
at Parser.withTopicForbiddingContext (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:9683:14)
at Parser.parseFunction (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:10497:10)
at Parser.parseExportDefaultExpression (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:10960:19)
at Parser.parseExport (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:10868:31)
at Parser.parseStatementContent (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:9892:27)
at Parser.parseStatement (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:9788:17)
at Parser.parseBlockOrModuleBlockBody (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:10364:25)
at Parser.parseBlockBody (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:10351:10)
at Parser.parseTopLevel (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:9717:10)
at Parser.parse (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:11233:17)
at parse (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/parser/lib/index.js:11269:38)
at parser (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/core/lib/transformation/normalize-file.js:170:34)
at normalizeFile (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/core/lib/transformation/normalize-file.js:138:11)
at runSync (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/core/lib/transformation/index.js:44:43)
at runAsync (/Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/core/lib/transformation/index.js:35:14)
at /Users/manu.mehrotra/Downloads/keditor-master 3/node_modules/@babel/core/lib/transform.js:34:34
at processTicksAndRejections (internal/process/task_queues.js:82:9)
@ ./src/keditor/contentArea/initContentArea.js 5:0-55 21:31-46
@ ./src/keditor/setContent.js
@ ./src/keditor/index.js