React-native-windows: Update getting started documentation to recommend 0.61 instead of 0.60

Created on 26 Mar 2020  路  13Comments  路  Source: microsoft/react-native-windows

These docs: https://microsoft.github.io/react-native-windows/docs/getting-started

Should update from this:

npx react-native init <project name> --version ^0.60.0

to instead point to 0.61, now that it's out of beta.

Documentation enhancement

Most helpful comment

@kikisaints we should probably document this error, since the old recommendation of installing react native globally will have left many people with stale bits on their machine - and is why it's no longer recommended.

All 13 comments

Also, as we're building up a release checklist, this should be on the list.

While we are updating the instructions, I've streamlined the init process:

OLD:

npx react-native init <myproject> --version 0.61.5
cd <myproject>
yarn add rpnm-react-native-windows
npx react-native windows

NEW:

npx react-native init <myproject> --version 0.61.5
cd <myproject>
npx react-native-windows-init

npx react-native init <project name> --version ^0.60.0

I don't think the hat in ^0.60.0 works correctly without quotes. IIRC I saw a bug about that somewhere?

Though also I think specific versions are safer since patch releases might still break us.

yeah, the CLI doesn't support ranges, you have to specify a specific version, so it should be 0.61.5

@chrisglein can you log these types of issues over on the samples/website repo in the future? That would help me a lot 馃槄

Edit: Also, what's our Beta version now if that's still a thing?

npx --ignore-existing react-native init <myproject> --template react-native@^0.61 apparently works. So we should probably use that.

(added the --ignore-existing to work around an issue if people ran npm install -g react-native previously, and so have an old version laying around.)

I thought we were concerned at one point that patch releases could still break us. Is this not the case?

I think its ok to default to taking patch fixes. And if they break we'll find out. Otherwise no-one will tell us.

Hello acoates-ms I am getting this error while executing this below commands

npx react-native init react_native_windows_todo --version 0.61.5
cd react_native_windows_todo
npx react-native-windows-init

Environment


react-native -v:

  • react-native-cli: 2.0.1
  • react-native: 0.61.5

react-native run-windows --info:

System:

  • OS: Windows 10 10.0.18363
  • CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
  • Memory: 2.48 GB / 7.90 GB
    Binaries:
  • Node: 12.16.2 - C:\Program Files\nodejs\node.EXE
  • npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
  • react: 16.9.0 => 16.9.0
  • react-native: 0.61.5 => 0.61.5
  • react-native-windows: ^0.61.3 => 0.61.3
  • rnpm-plugin-windows: ^0.6.1 => 0.6.1
    Installed UWP SDKs:
  • 10.0.10240.0
  • 10.0.10586.0
  • 10.0.15063.0
  • 10.0.16299.0
  • 10.0.17134.0
  • 10.0.17763.0
  • 10.0.18362.0

Target Env:

  • Target Platform Version(s): 10.0.18362

  • Target Device(s): Desktop

  • Visual Studio Version: Visual Studio 2017

  • Build Configuration: Debug

Steps to Reproduce

(Write your steps here:)

  1. npx react-native init react_native_windows_todo --version ^0.61.5
  2. cd react_native_windows_todo
  3. npx react-native-windows-init

Expected Behavior

The expecting project has to create and run successfully.

Actual Behavior

But, getting an error while creating a project

[email protected] successfully installed.
Cannot find module '@react-native-community/cli/build/tools/copyAndReplace'
Require stack:

  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native-windows\local-cli\generator-common\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native-windows\local-cli\generator-windows\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native-windows\local-cli\generate-windows.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\rnpm-plugin-windows\src\windows.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\rnpm-plugin-windows\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\rnpm-plugin-windows\react-native.config.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\import-fresh\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\cosmiconfig\dist\loaders.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\cosmiconfig\dist\createExplorer.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\cosmiconfig\dist\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\config\readConfigFromDisk.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\config\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\install\install.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\cli.js
  • c:\Users\Admin\AppData\Roaming\npm\node_modules\react-native-cli\index.js
    Error: Cannot find module '@react-native-community/cli/build/tools/copyAndReplace'
    Require stack:
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native-windows\local-cli\generator-common\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native-windows\local-cli\generator-windows\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native-windows\local-cli\generate-windows.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\rnpm-plugin-windows\src\windows.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\rnpm-plugin-windows\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\rnpm-plugin-windows\react-native.config.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\import-fresh\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\cosmiconfig\dist\loaders.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\cosmiconfig\dist\createExplorer.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\cosmiconfig\dist\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\config\readConfigFromDisk.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\config\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\install\install.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js
  • F:\Vs Apps\react_native_windows_todo\node_modules\react-native\cli.js
  • c:\Users\Admin\AppData\Roaming\npm\node_modules\react-native-cli\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object. (F:\Vs Apps\react_native_windows_todo\node_modules\react-native-windows\local-cli\generator-common\index.js:4:24)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1042:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'F:\Vs Apps\react_native_windows_todo\node_modules\react-native-windows\local-cli\generator-common\index.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\react-native-windows\local-cli\generator-windows\index.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\react-native-windows\local-cli\generate-windows.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\rnpm-plugin-windows\src\windows.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\rnpm-plugin-windows\index.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\rnpm-plugin-windows\react-native.config.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\import-fresh\index.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\cosmiconfig\dist\loaders.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\cosmiconfig\dist\createExplorer.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\cosmiconfig\dist\index.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\config\readConfigFromDisk.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\tools\config\index.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\install\install.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\index.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js',
    'F:\Vs Apps\react_native_windows_todo\node_modules\react-native\cli.js',
    'c:\Users\Admin\AppData\Roaming\npm\node_modules\react-native-cli\index.js'

@chrisglein this issue is fixed, however we have an issue from someone around trying to execute the commands. Should we close this?

@acoates-ms have you gotten a chance to take a look at the issue @tejaat1995 commented?

@tejaat1995 this is caused by a stale version of react-native installed globally on your machine. please uninstall your global copy of react-native. Or update it.

npm uninstall -g react-native

@kikisaints we should probably document this error, since the old recommendation of installing react native globally will have left many people with stale bits on their machine - and is why it's no longer recommended.

I've added an issue on the samples repo to capture that troubleshooting tip:
https://github.com/microsoft/react-native-windows-samples/issues/67
Closing this issue as we have update the docs to point to 61.

Was this page helpful?
0 / 5 - 0 ratings