出现错误“找不到模块”在服务器上但本地有效

发布于 2025-01-15 02:44:35 字数 1106 浏览 3 评论 0原文

我创建此错误是为了帮助可能遇到相同问题的其他开发人员。我花了一些时间解决这个问题,解决方案非常简单。

场景是:本地一切正常,我仔细检查了 cloubuild 中的配置是否相同。 (就我而言,它发生在 cloudbuild 上,但也可能发生在任何服务器上)

但是,我收到以下错误:

./src/app/shared/markdown-editor/markdown-editor.constant.ts:56:0-35 - Error: Module not found: Error: Can't resolve 'easyMDE' in '/workspace/frontend/src/app/shared/markdown-editor'

./src/app/shared/markdown-editor/markdown-editor.directive.ts:620:0-35 - Error: Module not found: Error: Can't resolve 'easyMDE' in '/workspace/frontend/src/app/shared/markdown-editor'

Error: src/app/shared/markdown-editor/markdown-editor.constant.ts:1:26 - error TS2307: Cannot find module 'easyMDE' or its corresponding type declarations.

1 import * as EasyMDE from 'easyMDE';
                           ~~~~~~~~~


Error: src/app/shared/markdown-editor/markdown-editor.directive.ts:2:26 - error TS2307: Cannot find module 'easyMDE' or its corresponding type declarations.

2 import * as EasyMDE from 'easyMDE';

重点是: 本地一切正常,但我使用的是 macOS,它不区分大小写,但 cloudbuild 是基于 Linux 的。

I'm creating this error in order to help other developer who could have the same problem. I spent some time on it and the solution is pretty easy.

The scenario was: everything was working fine locally and I double checked if the configuration in cloubuild was the same. (In my case, it happened on cloudbuild, but it could happen on any server)

But there, I got the following error:

./src/app/shared/markdown-editor/markdown-editor.constant.ts:56:0-35 - Error: Module not found: Error: Can't resolve 'easyMDE' in '/workspace/frontend/src/app/shared/markdown-editor'

./src/app/shared/markdown-editor/markdown-editor.directive.ts:620:0-35 - Error: Module not found: Error: Can't resolve 'easyMDE' in '/workspace/frontend/src/app/shared/markdown-editor'

Error: src/app/shared/markdown-editor/markdown-editor.constant.ts:1:26 - error TS2307: Cannot find module 'easyMDE' or its corresponding type declarations.

1 import * as EasyMDE from 'easyMDE';
                           ~~~~~~~~~


Error: src/app/shared/markdown-editor/markdown-editor.directive.ts:2:26 - error TS2307: Cannot find module 'easyMDE' or its corresponding type declarations.

2 import * as EasyMDE from 'easyMDE';

The point is:
Local everything was working but I was in a macOS and it is not case sensitive, but cloudbuild is linux based.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回眸一遍 2025-01-22 02:44:35

为了解决这个问题,请检查您使用的库是否有大写字母并仅使用小写字母:

import * as EasyMDE from 'easymde';

而不是:

import * as EasyMDE from 'easyMDE';

In order to solve it, check if the library you are using has capital letters and use only lower-case letters:

import * as EasyMDE from 'easymde';

instead of:

import * as EasyMDE from 'easyMDE';
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文