Skip to content

Running init with a nightly version doesn't stamp the correct version #2511

Description

@jonthysell

Environment

info Fetching system and libraries information...
System:
OS: Windows 11 10.0.26100
CPU: "(24) x64 AMD Ryzen Threadripper PRO 3945WX 12-Cores "
Memory: 54.54 GB / 63.86 GB
Binaries:
Node:
version: 18.18.0
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 3.6.4
path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm:
version: 9.8.1
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions:
- 10.0.19041.0
- 10.0.22621.0
IDEs:
Android Studio: Not Found
Visual Studio:
- 17.12.35309.182 (Visual Studio Enterprise 2022)
- 17.11.35312.102 (Visual Studio Enterprise 2022)
Languages:
Java: Not Found
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 14.0.0-alpha.11
wanted: 14.0.0-alpha.11
react:
installed: 19.0.0-rc-fb9a90fa48-20240614
wanted: 19.0.0-rc-fb9a90fa48-20240614
react-native:
installed: 0.77.0-nightly-20240918-bebd6531b
wanted: nightly
react-native-windows:
installed: 0.0.0-canary.868
wanted: 0.0.0-canary.868
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

Description

I need to be able to create a new project with a specific (nightly) RN version. If I call @react-native-community/cli init with a particular version of RN, I expect the project to use that particular version.

This worked fine before the changes from needing to call @react-native-community/cli instead of react-native and the template being moved into it's own package.

Reproducible Demo

Run

npx --yes @react-native-community/cli@latest init testcsapp --version 0.76.0-nightly-20240901-305b4357e --verbose --skip-install --install-pods false --skip-git-init true

Check package.json, see nightly versions and incorrect CLI dependencies everywhere.

Actual:

"dependencies": {
    "react": "19.0.0-rc-fb9a90fa48-20240614",
    "react-native": "nightly"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
    "@react-native-community/cli": "14.0.0-alpha.11",
    "@react-native-community/cli-platform-android": "14.0.0-alpha.11",
    "@react-native-community/cli-platform-ios": "14.0.0-alpha.11",
    "@react-native/babel-preset": "nightly",
    "@react-native/eslint-config": "nightly",
    "@react-native/metro-config": "nightly",
    "@react-native/typescript-config": "nightly",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "19.0.0-rc-fb9a90fa48-20240614",
    "typescript": "5.0.4"
  },

Expected:

"dependencies": {
    "react": "19.0.0-rc-fb9a90fa48-20240614",
-    "react-native": "nightly"
+    "react-native": "0.76.0-nightly-20240901-305b4357e"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
-    "@react-native-community/cli": "14.0.0-alpha.11",
+    "@react-native-community/cli": "14.0.0",
-    "@react-native-community/cli-platform-android": "14.0.0-alpha.11",
+    "@react-native-community/cli-platform-android": "14.0.0",
-    "@react-native-community/cli-platform-ios": "14.0.0-alpha.11",
+    "@react-native-community/cli-platform-ios": "14.0.0",
-    "@react-native/babel-preset": "nightly",
+    "@react-native/babel-preset": "0.76.0-nightly-20240901-305b4357e",
-    "@react-native/eslint-config": "nightly",
+    "@react-native/eslint-config": "0.76.0-nightly-20240901-305b4357e",
-    "@react-native/metro-config": "nightly",
+    "@react-native/metro-config": "0.76.0-nightly-20240901-305b4357e",
-    "@react-native/typescript-config": "nightly",
+    "@react-native/typescript-config": "0.76.0-nightly-20240901-305b4357e",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "19.0.0-rc-fb9a90fa48-20240614",
    "typescript": "5.0.4"
  },

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions