Skip to content
This repository has been archived by the owner on Jan 6, 2021. It is now read-only.

Command causing cross-shell-env to fail silently #246

Closed
chrisahardie opened this issue Jul 21, 2020 · 2 comments
Closed

Command causing cross-shell-env to fail silently #246

chrisahardie opened this issue Jul 21, 2020 · 2 comments

Comments

@chrisahardie
Copy link

  • cross-env 7.0.2:
  • node version: 12.6.1
  • npm (or yarn) version: 6.13.4

Relevant code or config

// package.json
"dependencies": {
    "react": "^16.13.0",
    "react-dom": "^16.13.0",
    "react-scripts": "3.4.1",
  },
  devDependencies: {
    "cross-env": "7.0.2",
  }
  "scripts": {
    "start": "react-scripts start",
    "build:prod": "node -r dotenv/config node_modules/react-scripts/scripts/build.js dotenv_config_path=config/.env.production",
    "dynamicBuild:prod": "cross-env NODE_APP_INSTANCE=\"production\" npm run dynamicBuild",
    "dynamicBuild": "cross-env-shell \"node -r dotenv/config node_modules/react-scripts/scripts/build.js dotenv_config_path=config/.env.$NODE_APP_INSTANCE\"",

What you did:

I have created a working build:prod script that reads in a environment file.

I then attempted to break my build:prod up so that I could create adynamicBuild script that I could use when building for different environments.

What happened:

When I execute dynamicBuild:prod I get very little output:

> hui-new-gen@0.1.0 dynamicBuild:prod C:\Users\chardie\Documents\Repos\hui-new-gen
> cross-env NODE_APP_INSTANCE="production" npm run dynamicBuild

> hui-new-gen@0.1.0 dynamicBuild C:\Users\chardie\Documents\Repos\hui-new-gen
> cross-env-shell "node -r dotenv/config node_modules/react-scripts/scripts/build.js dotenv_config_path=config/.env.$NODE_APP_INSTANCE"  

I have identified the issue as the dotenv_config_path flag in dynamicBuild - if I remove it, my build will at least kick off, though obviously not with the desired env file.

Since I'm not getting any feedback, is there something I can do to get some more verbose logging?

Reproduction repository:

https://github.com/chrisahardie/cross-env-repo

Problem description:

cross-env-shell is not kicking off a build if the dotenv_config_path flag is set.

Suggested solution:

@chrisahardie chrisahardie changed the title Command causing Command causing cross-shell-env to fail silently Jul 21, 2020
@tylim88
Copy link

tylim88 commented Nov 23, 2020

this issue is similar to my issue, my deduction is the equal sign (=) fail the command

here is how I test it

"test":"cross-env-shell \"echo testing\""
print out testing

"test":"cross-env-shell \"echo 123\""
print out 123

"test":"cross-env-shell \"echo testing=123\""
print nothing

@kentcdodds
Copy link
Owner

#257

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants