Skip to content

[rush] rushx does not support npm environment vars (e.g. npm_package_version) #3520

Open

Description

Summary

I have a create-react-app project with an environment file (.env) that contains the following line:

REACT_APP_VERSION=$npm_package_version

When running npm run start or pnpm run start, the variable gets populated with the correct version number from the package.json. When running rushx start, this does not work. The environment variable stays empty.

Repro steps

Setup a new Rush installation with a single project inside, only containing a package.json with the following contents:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "test": "echo $npm_package_version"
  },
  "author": "",
  "license": "ISC"
}

Then run the following command in that project:

rushx test

Expected result:

$ npm run test
> echo $npm_package_version

1.0.0

Actual result:

$ rushx test
> "echo $npm_package_version"

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? @microsoft/rush@5.71.0
rushVersion from rush.json? 5.74.0
useWorkspaces from rush.json? true
Operating system? Mac Apple Silicon
Would you consider contributing a PR? Yes
Node.js version (node -v)? 18.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    effort: mediumNeeds a somewhat experienced developerhelp wantedIf you're looking to contribute, this issue is a good place to start!

    Type

    No type

    Projects

    • Status

      Low priority

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions