GithubHelp home page GithubHelp logo

Comments (8)

lucasljsb avatar lucasljsb commented on July 27, 2024 4

@aikodeio
I had the same problem. Corrected combining with cross-env, like this:

{ "scripts": { "build": "cross-env BUILD_ENV=production gatsby build" } }

I hope this helps you.

from gatsby-env-variables.

aikodeio avatar aikodeio commented on July 27, 2024

I don't understand this step:

BUILD_ENV=staging yarn start

my package.json file has the following script:

...
"scripts": {
    "develop": "gatsby develop",
    "start": "npm run develop",
    "build": "gatsby build",
    "serve": "gatsby serve"
}
...

from gatsby-env-variables.

aikodeio avatar aikodeio commented on July 27, 2024

@luanbitar help plis :( thanks

from gatsby-env-variables.

luanbitar avatar luanbitar commented on July 27, 2024

Hi @aikodeio, you will tell what environment you want to build, you can do this when you will run the commands, like BUILD_ENV=staging yarn build in your terminal if you want to build using staging config, or you can create a npm script to do this,

"scripts": {
    "develop": "gatsby develop",
    "start": "npm run develop",
    "build": "gatsby build",
	"build:staging": "BUILD_ENV=staging yarn build",
    "serve": "gatsby serve"
}

Did you understand?

from gatsby-env-variables.

aikodeio avatar aikodeio commented on July 27, 2024

@luanbitar Thanks for answering me.

I am executing the following command in the console

BUILD_ENV=staging yarn build

but I get the following error:

"BUILD_ENV" is not recognized as an internal or external command,
program or executable batch file.

Do I need to add something else?

from gatsby-env-variables.

aikodeio avatar aikodeio commented on July 27, 2024
{
    "name": "test-env",
    "private": true,
    "version": "1.0.0",
    "dependencies": {
        "gatsby": "^2.20.7",
        "gatsby-env-variables": "^2.0.0",
        "gatsby-image": "^2.3.1",
        "gatsby-plugin-manifest": "^2.3.3",
        "gatsby-plugin-offline": "^3.1.2",
        "gatsby-plugin-react-helmet": "^3.2.1",
        "gatsby-plugin-remove-trailing-slashes": "^2.2.1",
        "gatsby-plugin-sharp": "^2.5.3",
        "gatsby-source-filesystem": "^2.2.2",
        "gatsby-transformer-sharp": "^2.4.2",
        "prop-types": "^15.7.2",
        "react": "^16.13.1",
        "react-dom": "^16.13.1",
        "react-helmet": "^5.2.1",
    },
    "devDependencies": {
        "prettier": "^1.19.1"
    },
    "scripts": {
        "develop": "gatsby develop",
        "build": "gatsby build",
        "build:staging": "BUILD_ENV=staging yarn build",
        "build:production": "BUILD_ENV=production yarn build",
        "serve": "gatsby serve"
    }
}

from gatsby-env-variables.

aikodeio avatar aikodeio commented on July 27, 2024

@luanbitar excuse the insistence bro. But I cannot execute this

from gatsby-env-variables.

aikodeio avatar aikodeio commented on July 27, 2024

@lucasljsb Thank you! it worked perfectly

from gatsby-env-variables.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.