[英]while deploying my react project on netlify showing error: Can't resolve '../../assets/CV.pdf' in '/opt/build/repo/src/components/header'
Everything fine locally I am able to download pdf locally.在本地一切正常我可以在本地下载 pdf。 But while deploying on my site, its showing error below;
但是在我的网站上部署时,它在下面显示错误;
11:42:11 PM: Creating an optimized production build...
11:42:13 PM: Failed to compile.
11:42:13 PM: Module not found: Error: Can't resolve
'../../assets/CV.pdf' in '/opt/build/repo/src/components/header'
11:42:13 PM: "build.command" failed
11:42:13 PM: Error message
11:42:13 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
11:42:13 PM: Error location
11:42:13 PM: In Build command from Netlify app
You can take a look at my code from here .您可以从这里查看我的代码。 It works locally but I can't deploy.
它在本地工作,但我无法部署。
The error above appears to be concluding 3rd line not to be compiled successfully;上面的错误似乎是第 3 行未成功编译的结论;
11:42:13 PM: Module not found: Error: Can't resolve '../../assets/CV.pdf' in '/opt/build/repo/src/components/header'
As per the repo you shared above, there's cv.pdf
under /src/assets/
but not CV.pdf
like below and as it's stated within /src/components/header/CTA.js
;根据您在上面共享的回购协议,
/src/assets/
下有cv.pdf
但不是CV.pdf
如下所示,正如/src/components/header/CTA.js
中所述;
import CV from '../../assets/CV.pdf'
Like stated here at 4th paragraph within MDN Docs , Javascript is a case-sensitive language so that, CV.pdf and cv.pdf is totally different things like any other variable name represented in this context provides.正如MDN 文档中第 4 段所述,Javascript 是一种区分大小写的语言,因此CV.pdf和cv.pdf与此上下文中提供的任何其他变量名称完全不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.