Skip to content

Is npx needed? #886

Closed
Closed

Description

@mahyali

The server used to build our app doesn't have npx installed and we would prefer not installing it. Is there any benefit to using npx instead of just calling the react-native binary directly? The one in node_modules/.bin/react-native? Seems to me it accomplishes the same thing without the need for npx.

Activity

  1. added
    question
    on Dec 12, 2019
  2. thymikee commented on Dec 13, 2019

    @thymikee
    Member

    npx binary is assumed to be bundled with Node, that's why we use it. Calling node_modules/.bin/react-native is not easily portable in monorepos and across OSes (like Windows). Did you specifically remove it in your environment?

  3. cpojer commented on Jan 8, 2020

    @cpojer
    Member

    @thymikee We noticed this specifically at Facebook in an app that consumes React Native from open source rather than our internal version and therefore is using the cli packages which our internal version doesn't. We do not have npx or internet access available there. I think the offending line is this one:

    def command = "${npx} --quiet --no-install react-native config"

    Could we provide a fallback or a way to configure this? What if we invoked node instead by taking a look at something like require.resolve('react-native/' + require('react-native/package.json').bin)?

  4. thymikee commented on Jan 8, 2020

    @thymikee
    Member

    @cpojer we'll migrate off of npx, it's causing too many issues.

  5. ikedm commented on Jan 14, 2020

    @ikedm

    @thymikee do you know how long before we have access to the non-npx version? This is preventing us from upgrading to RN 0.61 :(

  6. ikedm commented on Jan 30, 2020

    @ikedm

    @grabbou, thanks for working on this! How does your fix relates to this:

    https://github.com/facebook/react-native/blob/1fb815ed4314c1396999e64354ca0b5d4ed83663/react.gradle#L102 ?

    Is this a separate issue?

  7. grabbou commented on Apr 14, 2020

    @grabbou
    Member

    @dalmendray, we're removing that as of 0.63. See the linked #28415 for discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions