简体   繁体   English

在 .netlify 上部署我的 React 项目时显示错误:无法在 '/opt/build/repo/src/components/header' 中解析 '../../assets/CV.pdf'

[英]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.pdfcv.pdf与此上下文中提供的任何其他变量名称完全不同。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将应用程序部署到 Netlify:找不到模块:错误:无法解析 '/opt/build/repo/src' 中的 './pages/HomePage' - React app deployment to Netlify : Module not found: Error: Can't resolve './pages/HomePage' in '/opt/build/repo/src' Gatsby Netlify 构建错误:无法解析“/opt/build/repo/src/templates”中的“../components/GridTemplate/GridTemplate.js” - Gatsby Netlify build error: Can't resolve '../components/GridTemplate/GridTemplate.js' in '/opt/build/repo/src/templates' 找不到模块:错误:无法解析“/opt/build/repo/src”中的“./components/Scrolltotop” - Module not found: Error: Can't resolve './components/Scrolltotop' in '/opt/build/repo/src' 找不到模块:错误:无法解析“/opt/build/repo/src”中的“./components/layouts/Navbar” - Module not found: Error: Can't resolve './components/layouts/Navbar' in '/opt/build/repo/src' Netlify 'build.command failed: base: /opt/build/repo/client' 用于部署 React 应用程序 - Netlify 'build.command failed: base: /opt/build/repo/client' for deploying React app 放大 React 构建失败,显示“未找到模块:错误:无法解析‘/codebuild/output/src313005886/src/client-portal/src’中的‘./components/...’” - Amplify React build fail with "Module not found: Error: Can't resolve './components/...' in '/codebuild/output/src313005886/src/client-portal/src' " Netlify:PDF 的“找不到模块:错误:无法解析” - Netlify: "Module not found: Error: Can't resolve" for PDF Heroku 错误:找不到模块:错误:无法解析“.../src/main/js/components”中的“React” - Heroku Error: Module not found: Error: Can't resolve 'React' in '.../src/main/js/components 找不到模块:错误:无法在“/home/yusquen/Projectss/react-shop/src/components”中解析“../containers/Layout” - Module not found: Error: Can't resolve '../containers/Layout' in '/home/yusquen/Projectss/react-shop/src/components' 部署到 netlify 后,没有显示一页反应项目。 控制台显示错误“TypeError: Object(...) is not a function” - After deploying to netlify one page of react project is not showing. Console shows error "TypeError: Object(...) is not a function"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM