Netify持续出现构建错误的主机问题

huangapple go评论92阅读模式
英文:

hosting issue in netify continously having build error

问题

错误日志:

  1. 11:04:01 AM: 编译失败。
  2. 11:04:01 AM:
  3. 11:04:01 AM: 未找到模块:错误:无法解析 '/opt/build/repo/src/components/Portfolio2' 中的 'C:\Users\LG\Desktop\React\my-app\src\components\Portfolio\assets\video1.mp4'
  4. 11:04:02 AM:
  5. 11:04:02 AM: build.command”失败
  6. 11:04:02 AM: ────────────────────────────────────────────────────────────────
  7. 11:04:02 AM:
  8. 11:04:02 AM: 错误消息
  9. 11:04:02 AM: 命令退出码为1npm run build (https://ntl.fyi/exit-code-1)
  10. 11:04:02 AM:
  11. 11:04:02 AM: 错误位置
  12. 11:04:02 AM: Netlify应用的构建命令中:
  13. 11:04:02 AM: npm run build
  14. 11:04:02 AM:
  15. 11:04:02 AM: 解析的配置
  16. 11:04:02 AM: 构建:
  17. 11:04:02 AM: 命令:npm run build
  18. 11:04:02 AM: 命令来源:ui
  19. 11:04:02 AM: 发布:/opt/build/repo/build
  20. 11:04:02 AM: 发布来源:ui
  21. 11:04:03 AM: 阶段“构建站点”期间失败:构建脚本返回了非零退出码:2 (https://ntl.fyi/exit-code-2)
  22. 11:04:03 AM: 由于用户错误导致构建失败:构建脚本返回了非零退出码:2
  23. 11:04:03 AM: 构建失败:无法构建站点
  24. 11:04:03 AM: 31.714秒内完成构建请求的处理

无法解决这个错误。这个错误一直在我的所有项目中反复发生,有人可以帮忙吗?

英文:

Error Log:

  1. 11:04:01 AM: Failed to compile.
  2. 11:04:01 AM:
  3. 11:04:01 AM: Module not found: Error: Can't resolve 'C:\Users\LG\Desktop\React\my-app\src\components\Portfolio\assets\video1.mp4' in '/opt/build/repo/src/components/Portfolio2'
  4. 11:04:02 AM:
  5. 11:04:02 AM: "build.command" failed
  6. 11:04:02 AM: ────────────────────────────────────────────────────────────────
  7. 11:04:02 AM:
  8. 11:04:02 AM: Error message
  9. 11:04:02 AM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
  10. 11:04:02 AM:
  11. 11:04:02 AM: Error location
  12. 11:04:02 AM: In Build command from Netlify app:
  13. 11:04:02 AM: npm run build
  14. 11:04:02 AM:
  15. 11:04:02 AM: Resolved config
  16. 11:04:02 AM: build:
  17. 11:04:02 AM: command: npm run build
  18. 11:04:02 AM: commandOrigin: ui
  19. 11:04:02 AM: publish: /opt/build/repo/build
  20. 11:04:02 AM: publishOrigin: ui
  21. 11:04:03 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
  22. 11:04:03 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
  23. 11:04:03 AM: Failing build: Failed to build site
  24. 11:04:03 AM: Finished processing build request in 31.714s

Cant resolve this error .It is repetedely happening with all my projects can anyone help

答案1

得分: 2

看起来你是这样导入视频文件的。

  1. import Video from "./assets/video1.mp4";

请不要在文件中包含完整的本地URL。你应该使用这个代替。

英文:

It looks like you are importing the video file like this.

  1. import Video from "C:\Users\LG\Desktop\React\my-app\src\components\Portfolio\assets\video1.mp4"

Please don't include the full local URL in your file. You have to use this instead:

  1. import Video from "./assets/video1.mp4"

huangapple
  • 本文由 发表于 2023年6月9日 13:57:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/76437566.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定