Gatsby: [v2] 在 Netlify 上构建突破

创建于 2018-09-16  ·  5评论  ·  资料来源: gatsbyjs/gatsby

描述

构建在本地工作,但在 Netlify 上失败。

重现步骤

项目在这里: https :

预期结果

我希望它能够正常构建。

实际结果

构建在本地工作正常,但在 Netlify 上中断:

error Generating JavaScript bundles failed

  Error: ./src/components/Page/index.js
  Module not found: Error: Can't resolve '../Footer' in '/opt/build/repo/src/com  ponents/Page'
  resolve '../Footer' in '/opt/build/repo/src/components/Page'
    using description file: /opt/build/repo/package.json (relative path: ./src/c  omponents/Page)
      Field 'browser' doesn't contain a valid alias configuration
      using description file: /opt/build/repo/package.json (relative path: ./src  /components/Footer)
        no extension
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/Footer doesn't exist
        .js
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/Footer.js doesn't exist
        .jsx
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/Footer.jsx doesn't exist
        as directory
          /opt/build/repo/src/components/Footer doesn't exist
  [/opt/build/repo/src/components/Footer]
  [/opt/build/repo/src/components/Footer.js]
  [/opt/build/repo/src/components/Footer.jsx]
   @ ./src/components/Page/index.js 8:0-31 69:29-35
   @ ./src/templates/post.js
   @ ./.cache/async-requires.js
   @ ./.cache/production-app.js


  Error: ./src/templates/post.js
  Module not found: Error: Can't resolve '../components/PostView' in '/opt/build  /repo/src/templates'
  resolve '../components/PostView' in '/opt/build/repo/src/templates'
    using description file: /opt/build/repo/package.json (relative path: ./src/t  emplates)
      Field 'browser' doesn't contain a valid alias configuration
      using description file: /opt/build/repo/package.json (relative path: ./src  /components/PostView)
        no extension
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/PostView doesn't exist
        .js
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/PostView.js doesn't exist
        .jsx
          Field 'browser' doesn't contain a valid alias configuration
          /opt/build/repo/src/components/PostView.jsx doesn't exist
        as directory
          /opt/build/repo/src/components/PostView doesn't exist
  [/opt/build/repo/src/components/PostView]
  [/opt/build/repo/src/components/PostView.js]
  [/opt/build/repo/src/components/PostView.jsx]
   @ ./src/templates/post.js 5:0-46 16:26-34
   @ ./.cache/async-requires.js
   @ ./.cache/production-app.js

环境

  System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.10.0 - ~/.nvm/versions/node/v10.10.0/bin/node
    Yarn: 1.9.4 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.10.0/bin/npm
  Browsers:
    Safari: 11.1.2
  npmPackages:
    gatsby: ^2.0.0-rc.25 => 2.0.0-rc.25 
    gatsby-plugin-react-helmet: ^3.0.0-rc.1 => 3.0.0-rc.1 
    gatsby-plugin-styled-components: ^3.0.0-rc.5 => 3.0.0-rc.5 
    gatsby-source-filesystem: ^2.0.1-rc.6 => 2.0.1-rc.6 
    gatsby-transformer-remark: ^2.1.1-rc.5 => 2.1.1-rc.5 

最有用的评论

我也围绕同样的问题兜圈子。

这为我解决了它:

git config core.ignorecase false

我从来没有遇到过区分大小写的文件名更改的问题。
要么只是巧合,要么这是 Gatsby v2 Starter 的一部分?

所有5条评论

这是因为您需要的内容和文件名存在大小写差异。 这适用于 Mac,不适用于 Linux。

我也围绕同样的问题兜圈子。

这为我解决了它:

git config core.ignorecase false

我从来没有遇到过区分大小写的文件名更改的问题。
要么只是巧合,要么这是 Gatsby v2 Starter 的一部分?

在推送到 docker 容器时如何解决这个问题?

我有同样的问题,我通过手动更改导入来修复。

前:
import Features from "../components/features/features";
后:
import Features from "../components/features/Features";

归功于StackOverFlow 上的

刚刚遇到了同样的错误。 这不应该是在开发中产生错误的东西吗?

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

dustinhorton picture dustinhorton  ·  3评论

ferMartz picture ferMartz  ·  3评论

ghost picture ghost  ·  3评论

rossPatton picture rossPatton  ·  3评论

Oppenheimer1 picture Oppenheimer1  ·  3评论