出现错误“找不到模块”在服务器上但本地有效
我创建此错误是为了帮助可能遇到相同问题的其他开发人员。我花了一些时间解决这个问题,解决方案非常简单。
场景是:本地一切正常,我仔细检查了 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了解决这个问题,请检查您使用的库是否有大写字母并仅使用小写字母:
而不是:
In order to solve it, check if the library you are using has capital letters and use only lower-case letters:
instead of: