'gatsby build'在Travis CI中失败-错误#98123 WEBPACK

问题描述 投票:2回答:1

我正在尝试使用AWS S3,CloudFront,CodePipeline和Travis CI部署我的投资组合网站。一切正常,但是Travis CI构建不断失败。

gatsby build给我一个错误:

error #98123 WEBPACK

Generating JavaScript bundles failed

This question与我的非常相似,但是解决方案与我的无关,因为我没有yarn文件,并且我尝试重新安装我的npm依赖项。

这里是我的日志的副本:


Generating JavaScript bundles failed

Can't resolve '../components/Layout' in '/home/travis/build/stomg7969/react-portfolio/src/pages'

File: src/pages/index.js

See our docs page for more info on this error: https://gatsby.dev/issue-how-to

error #98123 WEBPACK 

Generating JavaScript bundles failed

Can't resolve '../components/Layout' in '/home/travis/build/stomg7969/react-portfolio/src/pages'

File: src/pages/404.js

See our docs page for more info on this error: https://gatsby.dev/issue-how-to

The command "gatsby clean && gatsby build" exited with 1.

store build cache

Done. Your build exited with 1.

这是我的package.json

  "name": "gatsby-starter-spectral",
  "version": "0.0.1",
  "description": "Gatsby.js V2 starter template based on Spectral by HTML5 UP",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/anubhavsrivastava/gatsby-starter-spectral.git"
  },
  "author": {
    "name": "Anubhav Srivastava",
    "email": "[email protected]"
  },
  "dependencies": {
    "gatsby": "^2.13.39",
    "gatsby-plugin-manifest": "^2.2.3",
    "gatsby-plugin-offline": "^2.1.0",
    "gatsby-plugin-react-helmet": "^3.0.12",
    "gatsby-plugin-sass": "^2.0.11",
    "node-sass": "^4.12.0",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-helmet": "^5.2.1",
    "react-images": "1.0.0",
    "react-scrollspy": "^3.4.0",
    "smoothscroll-polyfill": "^0.4.4"
  },
  "scripts": {
    "develop": "gatsby develop",
    "build": "npm run clean && gatsby build",
    "deploy": "npm run clean && gatsby build --prefix-paths && gh-pages -d public",
    "serve": "gatsby serve",
    "clean": "rimraf .cache public",
    "format": "prettier --write '**/*.js'",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "devDependencies": {
    "gh-pages": "^2.0.1",
    "prettier": "^1.17.0",
    "rimraf": "^2.6.3"
  },
  "keywords": [
    "gatsby",
    "gatsby-starter",
    "gatsby-starter-spectral"
  ],
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/anubhavsrivastava/gatsby-starter-spectral/issues"
  },
  "homepage": "https://github.com/anubhavsrivastava/gatsby-starter-spectral#readme"
}

最后,这是我的.travis.yml文件。

language: node_js
node_js:
- 11.8.0
install: npm install
script: gatsby clean && gatsby build
deploy:
  provider: s3
  access_key_id: $AWS_KEY
  secret_access_key: $AWS_SECRET
  bucket: 'thedevelopark.com'
  skip_cleanup: true
  acl: public_read
  local_dir: public

提前感谢您的反馈。

npm yaml travis-ci gatsby
1个回答
1
投票

我遇到了同样的问题,并且尝试并检查了大小写敏感性一千次。什么也不会做。

然后我更改了组件的名称在所有区域中,文件名,导入,导出,都命名。现在可以了。

我不知道Netlify的组件名称“ Socials”是否存在问题?猜猜我永远也找不到。

© www.soinside.com 2019 - 2024. All rights reserved.