antvis / G6

♾ A Graph Visualization Framework in JavaScript.
https://g6.antv.antgroup.com/
MIT License
11.18k stars 1.33k forks source link

npm run build:site TypeError: Cannot set property 'typescript' of undefined #2696

Closed zhuolyang closed 3 years ago

zhuolyang commented 3 years ago

下载4.1.13版本代码,执行 npm install npm run bootstrap npm run build:site 访问本地site的 图标示例,页面闪现后报错 Cannot set property 'typescript' of undefined

TypeError: Cannot set property 'typescript' of undefined registerLanguage nodemodules/monaco-editor/esm/vs/basic-languages/.contribution.js:42 39 | } 40 | export function registerLanguage(def) { 41 | var languageId = def.id; 42 | languageDefinitions[languageId] = def; 43 | languages.register(def); 44 | var lazyLanguageLoader = LazyLanguageLoader.getOrCreate(languageId); 45 | languages.setMonarchTokensProvider(languageId, lazyLanguageLoader.whenLoaded().then(function (mod) { return mod.language; })); View compiled Module../node_modules/monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution.js nodemodules/monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution.js:6 3 | Licensed under the MIT License. See License.txt in the project root for license information. 4 | --------------------------------------------------------------------------------------------*/ 5 | import { registerLanguage } from '../.contribution.js'; 6 | registerLanguage({ 7 | id: 'typescript', 8 | extensions: ['.ts', '.tsx'], 9 | aliases: ['TypeScript', 'ts', 'typescript'], View compiled webpack_require /root/Demos/site/webpack/bootstrap:832 829 | }; 830 | 831 | // Execute the module function 832 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); 833 | 834 | // Flag the module as loaded 835 | module.l = true; View compiled fn /root/Demos/site/webpack/bootstrap:129 126 | ); 127 | hotCurrentParents = []; 128 | } 129 | return webpack_require(request); 130 | }; 131 | var ObjectFactory = function ObjectFactory(name) { 132 | return { View compiled ./include-loader!./node_modules/monaco-editor/esm/vs/editor/editor.api.js ./node_modules/monaco-editor/esm/vs/editor/editor.api.js?1119:80 webpack_require /root/Demos/site/webpack/bootstrap:832 829 | }; 830 | 831 | // Execute the module function 832 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); 833 | 834 | // Flag the module as loaded 835 | module.l = true; View compiled fn /root/Demos/site/webpack/bootstrap:129 126 | ); 127 | hotCurrentParents = []; 128 | } 129 | return webpack_require(request); 130 | }; 131 | var ObjectFactory = function ObjectFactory(name) { 132 | return { View compiled Module../node_modules/monaco-editor/esm/vs/basic-languages/fillers/monaco-editor-core.js node_modules/monaco-editor/esm/vs/basic-languages/fillers/monaco-editor-core.js:1 webpack_require /root/Demos/site/webpack/bootstrap:832 829 | }; 830 | 831 | // Execute the module function 832 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); 833 | 834 | // Flag the module as loaded 835 | module.l = true; View compiled fn /root/Demos/site/webpack/bootstrap:129 126 | ); 127 | hotCurrentParents = []; 128 | } 129 | return webpack_require(request); 130 | }; 131 | var ObjectFactory = function ObjectFactory(name) { 132 | return { View compiled Module../nodemodules/monaco-editor/esm/vs/basic-languages/.contribution.js nodemodules/monaco-editor/esm/vs/basic-languages/.contribution.js:1 webpack_require /root/Demos/site/webpack/bootstrap:832 829 | }; 830 | 831 | // Execute the module function 832 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); 833 | 834 | // Flag the module as loaded 835 | module.l = true; View compiled fn /root/Demos/site/webpack/bootstrap:129 126 | ); 127 | hotCurrentParents = []; 128 | } 129 | return webpack_require(request); 130 | }; 131 | var ObjectFactory = function ObjectFactory(name) { 132 | return { View compiled Module../node_modules/monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution.js node_modules/monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution.js:1 webpack_require /root/Demos/site/webpack/bootstrap:832 829 | }; 830 | 831 | // Execute the module function 832 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); 833 | 834 | // Flag the module as loaded 835 | module.l = true; View compiled fn /root/Demos/site/webpack/bootstrap:129 126 | ); 127 | hotCurrentParents = []; 128 | } 129 | return webpack_require(request); 130 | }; 131 | var ObjectFactory = function ObjectFactory(name) { 132 | return { View compiled ./include-loader!./node_modules/react-monaco-editor/node_modules/monaco-editor/esm/vs/editor/editor.api.js ./node_modules/react-monaco-editor/node_modules/monaco-editor/esm/vs/editor/editor.api.js?4aeb:78 webpack_require /root/Demos/site/webpack/bootstrap:832 829 | }; 830 | 831 | // Execute the module function 832 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); 833 | 834 | // Flag the module as loaded 835 | module.l = true; View compiled fn /root/Demos/site/webpack/bootstrap:129 126 | ); 127 | hotCurrentParents = []; 128 | } 129 | return webpack_require(request); 130 | }; 131 | var ObjectFactory = function ObjectFactory(name) { 132 | return { View compiled Module../node_modules/react-monaco-editor/lib/editor.js node_modules/react-monaco-editor/lib/editor.js:1 webpack_require /root/Demos/site/webpack/bootstrap:832 829 | }; 830 | 831 | // Execute the module function 832 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); 833 | 834 | // Flag the module as loaded 835 | module.l = true; View compiled fn /root/Demos/site/webpack/bootstrap:129 126 | ); 127 | hotCurrentParents = []; 128 | } 129 | return webpack_require(request); 130 | }; 131 | var ObjectFactory = function ObjectFactory(name) { 132 | return { View compiled Module../node_modules/react-monaco-editor/lib/index.js node_modules/react-monaco-editor/lib/index.js:1 webpack_require /root/Demos/site/webpack/bootstrap:832 829 | }; 830 | 831 | // Execute the module function 832 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); 833 | 834 | // Flag the module as loaded 835 | module.l = true; View compiled fn /root/Demos/site/webpack/bootstrap:129 126 | ); 127 | hotCurrentParents = []; 128 | } 129 | return webpack_require(request); 130 | }; 131 | var ObjectFactory = function ObjectFactory(name) { 132 | return { View compiled This screen is visible only in development. It will not appear if the app crashes in production. Open your browser’s developer console to further inspect this error.

请问如何解决,可以在本地查看 G6 website 图表示例?

Yanyan-Wang commented 3 years ago

node_modules 里面有 monaco-editor 重复的版本,删除旧的一个版本

zcolin commented 3 years ago

依然碰见此问题,“node_modules 里面有 monaco-editor 重复的版本,删除旧的一个版本”,这个请问如何操作,我现在在node_modules中发现有三个此库关联的 image 不知该如何删除? 在所有的package.json中也没有发现谁进行的引用。 其中react-monaco-editor的node_modules中的monaco-editor是0.23.0,而根目录node_modules中的monaco-editor是0.21.3,我尝试直接删除react-monaco-editor的node_modules中的monaco-editor删除或者根目录node_modules中的monaco-editor删除之后编译就会报错。也尝试了直接更改yarn.lock中的monaco-editor版本,直接用0.23.0并且确定在根目录的node_modules中已经安装了0.23.0,但是也是编译报错。

综上,确实是无能为力了,望赐教

zcolin commented 3 years ago

请问如何解决的?