Javascript using CodeMirror.js Error: Uncaught ReferenceError: CodeMirror is not defined

Javascript using CodeMirror.js Error: Uncaught ReferenceError: CodeMirror is not defined

当我尝试使用 HTML 和 JavaScript 库 'CodeMirror':

创建代码编辑器时,我在浏览器中看到了这个错误
Uncaught ReferenceError: CodeMirror is not defined
    at index.html?_ijt=2cf0kfsr3jnpb58d7jndumktte:68

但是考虑到我当时在我的 index.html 中链接,我无法弄清楚哪里出了问题:

<!--  CodeMirror  -->
    <link rel="stylesheet" href="codemirror/CodeMirror-master/CodeMirror-master/lib/codemirror.css">
    <script type="module" src="codemirror/CodeMirror-master/CodeMirror-master/src/codemirror.js"></script>
    <script type="module" src="codemirror/CodeMirror-master/CodeMirror-master/mode/javascript/javascript.js"></script>

如果我想在我的代码中包含这个库,是否必须使用 node.js

编辑:

我更改了我添加到另一个版本的文件,现在只收到一个错误:

Uncaught ReferenceError: CodeMirror is not defined
    at index.html?_ijt=knaua520sd7qi1kst4958cmse4:74

HTML-代码:

    <link rel="stylesheet" href="codemirror/codemirror-5.61.0/lib/codemirror.css">
    <script type="module" src="codemirror/codemirror-5.61.0/lib/codemirror.js"></script>
    <script type="module" src="codemirror/codemirror-5.61.0/mode/javascript/javascript.js"></script>

我解决了这个问题:

<link rel="stylesheet" href="codemirror/codemirror-5.61.0/lib/codemirror.css">
    <script src="codemirror/codemirror-5.61.0/lib/codemirror.js"></script>
    <script src="codemirror/codemirror-5.61.0/mode/javascript/javascript.js"></script>

因此,要解决此问题,您必须创建 type="text/javascript" 或删除此参数,因为这是它的默认值。