Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby deployment fails on Codeship CI #5416

Closed
akhatri opened this issue May 15, 2018 · 2 comments
Closed

Gatsby deployment fails on Codeship CI #5416

akhatri opened this issue May 15, 2018 · 2 comments

Comments

@akhatri
Copy link

akhatri commented May 15, 2018

Description

My website project fails to build and deploy on the Codeship CI. It works locally and generates the static files as expected

Steps to reproduce

  1. prepare a simple gatsby project that runs locally and prepares the static files
  2. connect the Git repository with Codeship for automated deployment
  3. Prepare a custom script to build the project and install dependencies, as below
yarn global add gatsby-cli@latest
yarn global add gatsby
yarn install
gatsby build

Expected result

The project should build successfully

Actual result

At the gatsby build step i get this error
error There was a problem loading the local build command. Gatsby may not be installed. Perhaps you need to run "npm install"?

capture

Note: This error has appeared before as per my initial investigation and it was apparently fixed in the latest cli. I have the latest versions too that I've outlined below

Related links #1899 #1897

Environment

  • Gatsby version (npm list gatsby): gatsby@1.9.260
  • gatsby-cli version (gatsby --version): 1.9.260
  • Node.js version: v8.10.0
  • NPM version: 6.0.1
  • Operating System: Windows 10 local, Codeship instance is a Linux container (Ubuntu 14.04)

File contents (if changed)

gatsby-config.js: N/A
package.json:

  "engines": {
    "node": "8.10.0"
  },
  "dependencies": {
    "aos": "^2.2.0",
    "autoprefixer": "^7.2.5",
    "basic-auth": "^2.0.0",
    "bootstrap": "^4.0.0",
    "compression": "^1.7.1",
    "cross-env": "^5.1.3",
    "debug": "^3.1.0",
    "eslint": "^4.17.0",
    "eslint-config-airbnb": "^15.1.0",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.6.1",
    "express": "^4.16.2",
    "gatsby": "^1.9.260",
    "gatsby-cli": "^1.1.52",
    "gatsby-link": "^1.6.36",
    "gatsby-plugin-google-analytics": "^1.0.17",
    "gatsby-plugin-postcss-sass": "^1.0.16",
    "gatsby-plugin-react-helmet": "^1.0.8",
    "gatsby-plugin-react-next": "^1.0.8",
    "gatsby-source-filesystem": "^1.5.16",
    "gatsby-transformer-json": "^1.0.14",
    "gh-pages": "^1.1.0",
    "global": "^4.3.2",
    "helmet": "^3.10.0",
    "pixrem": "^4.0.1",
    "react-burger-menu": "^2.4.4",
    "serve-static": "^1.13.1",
    "shx": "^0.2.2",
    "svg-sprite-loader": "^3.6.2"
  }

gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

gatsby-config.js

const pixrem = require('pixrem');
const autoprefixer = require('autoprefixer');

module.exports = {
  siteMetadata: {
    title: `Gatsby Default Starter`,
  },
  plugins: [
    `gatsby-plugin-react-next`,
    `gatsby-plugin-react-helmet`,
    `svgo`,
    {
      resolve: `gatsby-plugin-postcss-sass`,
      options: {
        postCssPlugins: [
          pixrem(),
          autoprefixer({
            browsers: ['last 2 versions']
          })
        ],
        precision: 8
      }
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `data`,
        path: `${__dirname}/src/data/`,
      },
    },
    `gatsby-transformer-json`
  ],
}
@akhatri akhatri changed the title Gasty Deployment fails on Codeship CI Gatsby deployment fails on Codeship CI May 15, 2018
@akhatri
Copy link
Author

akhatri commented May 15, 2018

Update somehow gatsby build loads now by running the following steps. I deleted the package-lock.json file, took the updates yarn lock file and published it to github to trigger the deployment task

npm uninstall -g gatsby-cli
npm uninstall -g gatsby
yarn global add gatsby-cli@latest
yarn global add gatsby
yarn install
pwd
gatsby build

But now none of the plugins are installed. I get the following errors

Error: Cannot find module 'pixrem' so I commented that module but still stuck with the error below

success delete html and css files from previous builds  0.043 s
success open and validate gatsby-config  0.005 s
error Unable to find plugin "gatsby-plugin-react-next"


  Error: Unable to find plugin "gatsby-plugin-react-next"

@akhatri
Copy link
Author

akhatri commented May 15, 2018

So i was curious if it was the latest npm version and it indeed was. Downgrading it allows Codeship to build the project. Guess its not always great to rely on the latest version of NPM all the time 😄

  "engines": {
    "node": "7.9.0",
    "npm": "4.2.0"
  },

Script commands

npm install -g gatsby-cli@latest
npm install
gatsby build

@akhatri akhatri closed this as completed May 15, 2018
@akhatri akhatri reopened this May 21, 2018
@akhatri akhatri closed this as completed May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant