[英]Getting error 'Cannot find module' on server but local works
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.场景是:本地一切正常,我仔细检查了 cloubuild 中的配置是否相同。 (In my case, it happened on cloudbuild, but it could happen on any server)
(就我而言,它发生在 cloudbuild 上,但它可能发生在任何服务器上)
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.关键是:本地一切正常,但我在 macOS 中,它不区分大小写,但 cloudbuild 是基于 linux 的。
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';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.